Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Square Grid_R interpolation transposition #58

Open
jay-hennen opened this issue Oct 23, 2020 · 3 comments
Open

Square Grid_R interpolation transposition #58

jay-hennen opened this issue Oct 23, 2020 · 3 comments

Comments

@jay-hennen
Copy link
Contributor

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

gridded/gridded/grids.py

Lines 356 to 357 in 5217b8f

x = self.node_lon if variable.shape[0] == len(self.node_lon) else self.node_lat
y = self.node_lat if x is self.node_lon else self.node_lon

@ChrisBarker-NOAA
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants