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

Cannot find variable (z) data in netcdf #287

Closed
nickywright opened this issue Oct 11, 2024 · 6 comments · Fixed by #297
Closed

Cannot find variable (z) data in netcdf #287

nickywright opened this issue Oct 11, 2024 · 6 comments · Fixed by #297
Assignees

Comments

@nickywright
Copy link
Collaborator

GPlately seems to only read netcdfs that has its data variable called z.

E.g. I have this netcdf:
Screenshot 2024-10-11 at 6 17 13 pm

And when importing into gplately, I get:
Screenshot 2024-10-11 at 6 20 43 pm

If I then rename the variable topo to z, it all works fine:
Screenshot 2024-10-11 at 6 26 27 pm

Is there a way we can GPlately read netcdfs that do not always have 'z' as variable names?

@michaelchin
Copy link
Contributor

I agree that maybe we need a better way to deal with the data variable name. See the relevant code below.

gplately/gplately/grids.py

Lines 203 to 206 in da56af8

# possible permutations of lon/lat/z
label_lon = ["lon", "lons", "longitude", "x", "east", "easting", "eastings"]
label_lat = ["lat", "lats", "latitude", "y", "north", "northing", "northings"]
label_z = ["z", "data", "values", "Band1", "__xarray_dataarray_variable__"]

@michaelchin
Copy link
Contributor

michaelchin commented Oct 11, 2024

also maybe consider multiple data variables

I remember I saw a netcdf file in which the data was a multiple dimension array. Need to look into the netcdf file format deeper.

@michaelchin
Copy link
Contributor

This is an important issue. We need to provide a proper solution. But I have no time right now. Maybe @Hojat-Shirmard can have a look next week?

@Hojat-Shirmard
Copy link

I’d be happy if could help you with that. I’m heading to Hobart for a conference this Sunday and will be back on Monday, October 21.

@michaelchin
Copy link
Contributor

I’d be happy if could help you with that. I’m heading to Hobart for a conference this Sunday and will be back on Monday, October 21.

Sure. no rush, no pressure. any time that is convenient for you. safe trip.

@michaelchin michaelchin self-assigned this Oct 23, 2024
@michaelchin michaelchin linked a pull request Oct 23, 2024 that will close this issue
@michaelchin
Copy link
Contributor

@nickywright

The latest master branch should work now. See the test notebook below.

https://gist.github.com/michaelchin/ef0ec6184c8195065c130050a2075c2c

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

Successfully merging a pull request may close this issue.

3 participants