Closed JulesBlm closed 4 years ago
Sorry we weren't more helful here, this is indeed the kind of thing we want gridded to be able to do.
Did you find a solution?
Hi, I tried debugging Gridded for a while and if I remember correctly the error was in the parse_padding
function in read_netcdf.py, more specifically in the regex that parses the padding string. I couldn't figure it out so I ended up using xarray and writing my own plot methods to plot according to the sigma grid. These can be found here.
The processing_2d module of gridded is very useful for processing Delft3D output.
Thanks -- we really need to refactor the loading code -- it should have a cleaner distinction between parsing our the standards and loading the data -- making it easier to override the parsing part.
If you have a moderate size example, could you add it to this issue?
Thanks for your feedback.
Sure thing. I couldn't add it to this issue directly because files are limited to 10MB here. So I uploaded to my repo here. I had to remove a bunch of data variables from the dataset to keep it under GitHub's 100MB file limit, but grid metadata and all that stuff is still there so it's a good example.
Thanks for the response
I should mention that I'm 'abusing' Delft3D for geological modelling, so this output will not like a typical coastal model.
great thanks! Hopefully we can look at this at some point.
And no problem with the "abusing" -- ideally gridded is supposed to be fairly general purpose.
-CHB
Hi all, I'm trying to plot DELFT-3D FLOW NetCDF output. Plotting top-down plots of variables is fairly straightforward with xarray and matplotlib, but I'm having a hard time plotting vertical sections on an ocean sigma-grid. The output follow CF-1.6 and SGRID-0.3 conventions. I'm loading the NetCDF file using xarray which gives me the following info.
Grid description
The NetCDF's grid variable looks like this
MC is an array from 1 to 42. NC is an array from 1 to 61. XZ is a grid of X-coordinates of cell centres in m.
YZ is a grid of Y-coordinates of cell centres in m.
SIG_LYR is an array of the sigma-layer thicknesses, which become a lot more detailed towards the bottom.
SIG_INTF is similar only with Sigma coordinates of layer interfaces.
DPS contains the bottom depth in m at each timestep, which I guess is needed for a vertical cross-section plot in m.
Example of DataArray
This is an example of a variable in the dataset I would like to plot vertically on a sigma-grid
Things I've tried
Load dataset directly with 'gridded'
When I try to load the dataset with gridded as follow
I get this error
Load only one variable into gridded
If I only load one variable into gridded like this
I get this error
I'm really lost and at this point I'm not even sure if gridded is the right tool to help me plot with sigma-layers. Any help is appreciated, even if anyone could point me to an example with an ocean sigma-grid I'd be really grateful.