E3SM-Project / polaris

Testing and analysis for OMEGA, MPAS-Ocean, MALI and MPAS-Seaice
BSD 3-Clause "New" or "Revised" License
6 stars 13 forks source link

Allow patches to be reused in `plot_horiz_field()` #146

Closed xylar closed 11 months ago

xylar commented 11 months ago

This merge returns patches and patch_mask variables from plot_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 take patches and patch_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 in ds, the function needs to be called with a cell_mask argument that should typcially be cell_mask = ds_init.maxLevelCell >= 1 (though it could be another field such as landIceFloatingMaks if appropriate).

All steps that call plot_horiz_field() have been updated to supply the cell_mask argument or to use patches and patch_mask from a previous call.

Checklist

xylar commented 11 months ago

Testing

I ran all planar tasks (except 4km and 1km baroclinic channel RPE) on Chrysalis. I included the viz steps for the inertial gravity wave and manufactured solutions tasks. All images look as expected, e.g.: comparison

xylar commented 11 months ago

Further testing

This has sped up the init step of ISOMIP+ tasks at 1 km resolution (in preliminary testing) by more than a factor of 3 from ~32 minutes to ~9 minutes.

xylar commented 11 months ago

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 init step for ISOMIP+ at 1 km resolution takes less than a minute (even with smoothing over 2 cells)!!!

xylar commented 11 months ago

@cbegeman, thanks for your review and testing! This will be great to have in!