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 extraction #407

Closed Mikejmnez closed 5 months ago

Mikejmnez commented 5 months ago
example

Notice there are several geometry types defined and selected by the poseidon tool, and so these will be copied into the clipboard bundled together. That action generates the following json:

pnew = json.loads(get_shapes())
pnew
{'type': 'FeatureCollection',
 'features': [{'type': 'Feature',
   'properties': {'timeFrom': '2012-04-25T00:00:00.000Z',
    'timeTo': '2012-04-25T08:00:00.000Z'},
   'geometry': {'type': 'Polygon',
    'coordinates': [[[-49.39423193218302, 21.652186887750887],
      [-47.54401166786583, -4.241096331293235],
      [-10.010972020288738, -4.241096331293235],
      [-1.5528222405530512, 18.42461597093053],
      [-5.5175799498041425, 29.049519444696543],
      [-22.962513870508992, 27.1846556076123],
      [-27.98454030222706, 22.142679863561654],
      [-19.262073341874636, 18.92541577075147],
      [-10.539606381522212, 21.406311271560995],
      [-11.86119228460591, 9.45629361187676],
      [-21.640927967425295, 4.2093834199523315],
      [-39.87881342998037, 10.237557106013753],
      [-39.61449624936363, 20.418704257499954],
      [-43.314936777997985, 27.1846556076123],
      [-58.64533325376892, 26.94928795043414],
      [-61.552822240553056, 21.652186887750887],
      [-56.26647862821826, 18.675200810535287],
      [-56.002161447601516, 22.387289688558397],
      [-49.39423193218302, 21.652186887750887]]]}},
  {'type': 'Feature',
   'properties': {'timeFrom': '2012-04-25T00:00:00.000Z',
    'timeTo': '2012-04-25T08:00:00.000Z'},
   'geometry': {'type': 'Point',
    'coordinates': [-37.49995880442971, 56.15599523245322]}},
  {'type': 'Feature',
   'properties': {'timeFrom': '2012-04-25T00:00:00.000Z',
    'timeTo': '2012-04-25T08:00:00.000Z'},
   'geometry': {'type': 'LineString',
    'coordinates': [[-29.83476056654425, 35.091987524867804],
     [-27.19158876037684, 44.03609515845176],
     [-27.19158876037684, 48.42109044135867],
     [-28.51317466346055, 54.80814625184328]]}}]}

Now this is confusing to me, because of my preconceived notion of geometry and functionality of the different ways in which poseidon viewer can "sample" coordinates. This is, the Poseidon viewer app has three ways to sample coordinate data, called geometry:

The difference between them at sample time is the minimum number of points that a user needs to create with the tool, in order to select it and copy it the clipboard for use. But their biggest difference to me is their functionality.

I make the following assumptions regarding how to "best" use these geometries with oceanspy:

And so going back to the example above, it feels wrong. And the reason why this is important is because the generated data by the poseidon viewer will be passed as arguments to oceanspy's subsample methods. And so the arguments (coordinates) must make sense.

**question/proposition:

Are my preconceived ideas about shape and functionality off? I feel like the above case, when passing the json generated into oceanspy.utils.viewer2range should throw a Warning and only select one type of geometry from poseidon viewer data (e.g. the first one), or result in a Error. Either way there should be a clear message describing the relation between shape and functionality when integrating oceanspy and poseidon viewer...

ThomasHaine commented 5 months ago

Agreed. This needs to be clarified. @Mikejmnez can you coordinate with Mitya?

Mikejmnez commented 5 months ago

@ThomasHaine I think that we should just have a "best practice" on the user side somewhere in the documentation. And we should have a warning or an error within oceanspy that tells the user selected different geometry types with the poseidon viewer, and only one type was picked. What do you think?