-
Notifications
You must be signed in to change notification settings - Fork 143
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
Adding support for depth_level argument in Field.show() #478
Conversation
parcels/plotting.py
Outdated
@@ -186,10 +193,14 @@ def plotfield(field, show_time=None, domain=None, projection=None, land=True, | |||
|
|||
timestr = parsetimestr(field[0].grid.time_origin, show_time) | |||
titlestr = kwargs.pop('titlestr', '') | |||
if fld.grid.zdim > 1: | |||
depthstr = ' at depth %f ' % fld.grid.depth[depth_level] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for z-levels.
For s-levels, maybe you could put a warning or something that says that you show a constant level, which does not correspond to a constant depth.
parcels/plotting.py
Outdated
depthstr = ' at depth %f ' % fld.grid.depth[depth_level] | ||
if field[0].grid.zdim > 1: | ||
gphrase = 'depth' if field[0].grid.gtype in [GridCode.CurvilinearZGrid, GridCode.RectilinearZGrid] else 'level' | ||
depthstr = ' at %s %f ' % (gphrase, field[0].grid.depth[depth_level]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok with gphrase
but depthstr
shouldn't be like following?
depth_or_level = field[0].grid.depth[depth_level] if field[0].grid.gtype in [GridCode.CurvilinearZGrid, GridCode.RectilinearZGrid] else depth_level
depthstr = ' at %s %g ' % (gphrase, depth_or_level)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't think so. Say that the model is density-coordinate, then the value of field[0].grid.depth[depth_level]
is still a relevant parameter (e.g. 1027.3 kg/m3 or something like that). That's why in both cases I would print the value (in physical units) of the depth level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand.
Yes a density level is interesting, but in s-grid, field[0].grid.depth is an array with shape len 3 or 4. So printing field[0].grid.depth[depth_level]
does not work (This is not a scalar, but an array).
But indeed, plotting a depth level is also meaningful in s-grids.
This fixes #475