hainegroup / oceanspy

A Python package to facilitate ocean model data analysis and visualization.
https://oceanspy.readthedocs.io
MIT License
96 stars 32 forks source link

Poseidon Viewer yields lon values out of range of LLC-datasets #362

Closed Mikejmnez closed 1 year ago

Mikejmnez commented 1 year ago

While playing with the Poseidon viewer creating "arbitrary mooring arrays" I just realized that, in order to handle the "periodicity" of the dataset in the longitude direction, the Poseidon viewer yields lon values out of range of the dataset.

For example:

pacific_ocean

You can see in the top right corner that the last coordinate point of the array has longitude ~= -205.

This behavior can be fixed within ospy.utils.viewer_to_range(p) where the variable p is the JSON variable extracted directly from the poseidon viewer. The p- array is written below:

p = [{"type":"LineString","coordinates":[[-197.70925110132185,46.738180078212224],[-204.31718061674036,39.6192597442396],[-206.43171806167427,32.803195476048785],[-199.2951541850223,27.550874620866168],[-184.49339207048484,27.550874620866168],[-173.12775330396505,25.18292740506722],[-161.76211453744517,23.73942570079717],[-151.45374449339232,21.54409070759445],[-145.9030837004408,9.862821553780279],[-140.0881057268725,4.8839426144668465],[-150.13215859030865,-7.773399354255773],[-168.37004405286373,-18.314281138438588],[-175.5066079295157,-30.097794724729887],[-165.19823788546282,-43.570666810001505],[-125.02202643171833,-43.761866678224756],[-100.96916299559496,-34.77999492432185],[-96.4757709251104,-20.309711591650824],[-100.17621145374473,4.8839426144668465],[-123.70044052863463,29.86885112768998],[-131.10132158590332,49.04175972981676],[-150.6607929515421,53.027670279168035],[-179.47136563876677,49.900537014735335],[-197.70925110132185,46.55673041506063]]}]

NOTE

I navigated left in the Poseidon viewer to create the p-array above. Scrolling to the right and creating the exact same array would have yielded essentially the same long values from p- above, but with their sign reversed.

PR coming soon...