-
Notifications
You must be signed in to change notification settings - Fork 21
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
Reading UGRID-compliant NetCDF files #326
Comments
To make sure it's clear, EarthSim shouldn't include any code for reading files or pretty much anything else; it's almost entirely a collection of examples. It originally did have lots of code, but nearly all of that code has migrated into generic OSS libraries as planned, with the remainder expected to migrate out whenever we get a chance to do so. We try our hardest not to write anything deeply domain specific except for examples! Here, we'd be happy for EarthSim to include examples of reading UGRID NetCDF files via xarray, but are you asking for something beyond an example? E.g. extracting more of the metadata and making use of it better? If so I'd expect such changes to go into xarray or maybe GeoViews, not EarthSim. |
@jbednar, I was looking at the visualizing meshes notebook and saw that it contains:
|
D'oh! Any suggestions on where that code and any UGRID-supporting reading code should go in the long term? |
Maybe in https://github.com/xarray-contrib, where we already have https://github.com/xarray-contrib/cf-xarray? |
IIUC, you want to replace this line with a function that would parse the UGRID metadata and generate |
@ocefpaf, we already have something simple that will return tris, verts from a CF-compliant UGRID, don't we? |
@dcherian I agree that this would be an awesome addition to cf-xarray. This is what I wrote some time ago, it is virtually the UGRID spec as code. I think you can adapt that to cf-xarray without many problems, either using the same variable search "get_var_by" or a more modern approach. (I do not recommend depending on that code though! It was not meant to be a library.) |
Sounds great! Just to be clear, by "not depending on that code", do you just mean not importing from its current location in pyoceans/gridgeo/blob/master/gridgeo/ugrid.py? It sounds like you don't think it's in bad shape otherwise, and that once it's been moved to cf-xarray and cleaned up slightly it would be fine to depend on? |
Yep. Don't import that code from that library. The UGRID implementation/logic in there is solid. |
Sounds great! I'd love for there to be an example at EarthSim using such an implementation, imported from somewhere appropriate. Rich, if the code does get published properly in that way, then I'd be happy to help adapt one of our current examples to use it or to take a new example and add it to EarthSim. Do you think this UGRID support should replace the 3dm stuff, or should I keep looking for a place to put the earthsim.io readers in the long term? |
Not really replace but the 3DM output should ideally be UGRID compliant so standard tools can easily read it. That is the AdH model output, right? I recall helping some folks reading that as UGRID some years ago. Not sure if that effort evolved into code somewhere. Edit: found it! See cell [5] in https://nbviewer.jupyter.org/gist/ocefpaf/933da65c3e3faa0a2ff9c0838f60a3b0 |
Also see pydata/xarray#4222 |
It would be great if the earthsim.io module could read UGRID-compliant NetCDF files. UGRID adds onto the CF-Conventions to provide an unambiguous way of reading topology and variable locations on the mesh from an unstructured mesh NetCDF file.
An example triangular mesh dataset is here:
The text was updated successfully, but these errors were encountered: