-
Notifications
You must be signed in to change notification settings - Fork 201
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
Helper for outputting a NetCDF "grid file" #3997
Comments
For extending output utilities to variables that are not time-dependent I think this is just a matter of extending
So perhaps just a kwarg
|
Each grid will need to define a function that returns a list of all the possible metrics too. Because they are different for each grid. Or do we need to save every location even if they are redundant for some grids? |
Thanks for opening this issue! I don't think the metrics need to be different for different grids. Here is a list of metrics that would be helpful to have in the grid file, assuming we are on a C-grid:
The grid cell area could be skipped if we simply have
Is the above equation true for all grid types? Is it also worth outputting the grid cell volume if there are partial cells? Am I forgetting any useful metrics @tomchor? |
I don't think that is true for a curvilinear grid, for example for
|
Yes, although in principle because we make the thin shell approximation, one can derive the volume from area * dz. Still though I think it is better to output everything rather than miss a few things and create headaches / complicate user scripts that do analysis. |
I think so. It's simple and it makes users' lives easier :)
Not that I can tell. Although I'd standardize and output the same variables for all directions. Oceananigans is very general, so I don't think we should assume a priori that any simulation treats the vertical direction any differently from the others. There'll be some redundancy in the output for lots of simulations, but given how cheap it is to output these metrics, that's okay I think. |
Hmm so the missing metrics are the |
After learning a bit about how people work with NetCDF (😺 ) and discussing with @NoraLoose it seems there may be scope for a helper function that writes out a grid file. Something like:
write_grid_to_netcdf!(filename, grid)
Also internally, this functionality could be added to
NetCDFOutputWriter
, so that users could write something likeand include all the same grid metrics that are saved when using
write_grid_to_netcdf!
.Under the hood, I think this is accomplished by creating a special
NetCDFOutputWriter
and treating the grid metrics like output variables. One possible difference is that unlike other kinds of output the grid metrics do not have a time dimension. So we also need to generalize the scope of outputs forNetCDFOutputWriter
to outputs that don't have a time dimension? My NetCDF knowledge is a little hazy so please let me know if this isn't right.@ali-ramadhan @tomchor
The text was updated successfully, but these errors were encountered: