-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow patches to be reused in plot_horiz_field()
#146
Conversation
plot_horiz_field()
d3a1098
to
4c5570a
Compare
This merge also removes some ocean-specific variable and dimension names.
97fe053
to
a44f53b
Compare
Further testingThis has sped up the |
Oooh! The speed-up is far better than I thought! I messed up the culling in an unrelated change to this one. After fixing the culling, the |
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 looks great! I have tested inertial_gravity_wave on chrys with intel, openmpi since that is one of the tests that reuses patches. The viz looks the same as before.
@cbegeman, thanks for your review and testing! This will be great to have in! |
'from a previous call to plot_horiz_field()') | ||
else: | ||
if cell_mask is None: | ||
cell_mask = np.ones_like(field, type='bool') |
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.
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 should be a separate PR. I'm not sure how soon #144 will be ready to go in. Sorry about that.
This merge returns
patches
andpatch_mask
variables fromplot_horiz_field()
so they can be reused in subsequent calls. This should save a lot of time in tests that plot many fields. Corresponding input arguments have been added to takepatches
andpatch_mask
from previous plots on the same mesh.Note: you need need to keep patches for cells and edges separate.
This merge also removes some ocean-specific variable and dimension names. This because the function lives in the top-level framework so it should work for any component. Instead of providing
maxLevelCell
inds
, the function needs to be called with acell_mask
argument that should typcially becell_mask = ds_init.maxLevelCell >= 1
(though it could be another field such aslandIceFloatingMaks
if appropriate).All steps that call
plot_horiz_field()
have been updated to supply thecell_mask
argument or to usepatches
andpatch_mask
from a previous call.Checklist
Testing
comment in the PR documents testing used to verify the changes