NOAA-ORR-ERD / gridded

A single API for accessing / working with gridded model results on multiple grid types
https://noaa-orr-erd.github.io/gridded/index.html
The Unlicense
64 stars 14 forks source link

Square Grid_R interpolation transposition #58

Open jay-hennen opened 3 years ago

jay-hennen commented 3 years ago

If you use a Grid_R with lon and lat dimensions of the same length, and data ordered as (lat, lon), the streams will get crossed when you interpolate and your output gets mirrored.

In the case where they are the same size, further attribute cross referencing needs to be done to ensure correct dimension association

https://github.com/NOAA-ORR-ERD/gridded/blob/5217b8f244fee794b4e12c66cad89a0f66ff1c7f/gridded/grids.py#L356-L357

ChrisBarker-NOAA commented 3 years ago

I think this should be embedded n the CF standard.

As a rule, the code should always try to use the "standard" way to assign stuff, and only infer things is it has to.

This may be a case where it has to be inferred, but we should make that's so. ANd if it is, well, the fie is non compliant, and you get what you get :-)

AmyMacFadyen commented 2 years ago

Looks like we already had this bug reported, but it bit us again with the files Chris created recently. We need to prioritize a fix on this or disable loading regular grids with the same dimensions in lat/lon in PyGNOME before it gets us yet again...

ChrisBarker-NOAA commented 2 years ago

NOTE: we should be able to use the shared dimensions to figure out which is lat and lon.

i.e. the longitude variable should use a dimension that is different than the latitude variable, and by looking at the dimensions used by the other variables, know which to use.