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

Change the mapping to the grid variable to something that is model agnostic #68

Open
ocefpaf opened this issue Oct 28, 2015 · 3 comments

Comments

@ocefpaf
Copy link
Member

ocefpaf commented Oct 28, 2015

We can identify the edge1_coordinates coordinates with sgrid.edge1_coordinates, but the actual data is associated with the original model name (in ROMS case sgrid.lon_u).

Unless I am missing something if someone wants to create a "generic" grid reader we must do:

from netCDF4 import Dataset
nc = Dataset(url)
sgrid = pyugrid.UGrid.from_nc_dataset(nc)

edges = [nc[var] for var in sgrid.edge1_coordinates]

@ayan-usgs Is that correct? Maybe instead of sgrid.lon_u and sgrid.lon_v we should have a sgrid.edges.

@rsignell-usgs Are you using pysgrid in production? How do you read your grids?

@rsignell-usgs
Copy link
Contributor

@ocefpaf, your argument for sgrid.edges makes sense to me.

But I'd like to get @kwilcox opinion also.

The only application I know of that is using pysgrid right now is sci-wms, which I believe @kwilcox is focusing on this week. You could check out this routine:
https://github.com/sci-wms/sci-wms/blob/master/wms/models/datasets/sgrid.py

@ocefpaf
Copy link
Member Author

ocefpaf commented Oct 29, 2015

If I get what @kwilcox is doing he puts all edge variables into the grid center using pysgrid.processing_2d. Which is a good decision since sci-wms focus is to serve a visualization layer.

My concern is to provide a low level API to analyse variables at the edges. Some modelers do desire that feature. See this quote from the ROMS forum:

It is more physical to draw vectors at PSI-points. It will be consistent with the physical boundaries of the domain. It will also show the behavior around Land/Sea masking, if any.

@ayan-usgs
Copy link
Contributor

@ocefpaf,

Your assessment is correct. I think having sgrid.edges is a splendid idea.

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