MOM5 icon indicating copy to clipboard operation
MOM5 copied to clipboard

Save all grid variables unmasked

Open aekiss opened this issue 2 years ago • 6 comments

Many grid variables (area_t, area_u, geolon_t, geolat_t, etc) are saved with no mask, but others including dxt, dyt, dxu, dyu are land-masked - e.g. see /g/data/ik11/grids/ocean_grid_10.nc.

This makes it impossible to supply a single grid file that can be used with any land mask, which is what we're attempting in https://github.com/COSIMA/cosima-recipes/issues/212

This difference is because area_t, area_u, geolon_t, geolat_t, etc are output by send_data https://github.com/mom-ocean/MOM5/blob/5f70c21/src/mom5/ocean_core/ocean_grids.F90#L1691-L1713 whereas dxt, dyt, dxu, dyu are output via diagnose_2d or diagnose_2d_u https://github.com/mom-ocean/MOM5/blob/5f70c21/src/mom5/ocean_core/ocean_grids.F90#L1752-L1774 which mask the fields https://github.com/mom-ocean/MOM5/blob/master/src/mom5/ocean_core/ocean_util.F90#L898-L991

Is there any reason we shouldn't use send_data for all the horizontal grid diagnostics? diagnose_2d calls it anyway (via diagnose_2d_mask).

aekiss avatar Feb 03 '23 03:02 aekiss

@aekiss Are you sure about that being the only problem? You still have to take tile masking into account. The 1 degree model isn't masked (I think) but the others are and you get missing/Fill values where there are no tiles. Is this an issue?

russfiedler avatar Feb 03 '23 04:02 russfiedler

Yes, there will also be tile masking in production runs (even at 1 deg) but this fix is for a short one-off run to generate these grid files, where we remove ocean_mask_table so processor masking won't be used - see https://github.com/COSIMA/access-om2/wiki/Technical-documentation#Outputting-grid-files-with-no-processor-land-masking

aekiss avatar Feb 03 '23 04:02 aekiss

No need for anything so complicated. Mostly done here https://github.com/russfiedler/grid_spec_tools/blob/master/create_old_grid_spec.F90 Just need to change a few variable names and do the area/u grid stuff. There's a debug version there too.

russfiedler avatar Feb 03 '23 05:02 russfiedler

Ah thanks @russfiedler is that was was used to create /g/data/ik11/grids/ocean_grid_01.nc?

aekiss avatar Feb 06 '23 00:02 aekiss

@aekiss Yes, it looks like it. I think I may have had an enhanced version. I'll look about.

russfiedler avatar Feb 06 '23 03:02 russfiedler

@russfiedler I agree something like your create_old_grid_spec is way more sensible than running the model, and I'm writing code to do what I want based on this.

But I also think it's worth removing the masking for these fields so I've made a PR to do that. Would you like to look it over before I merge it?

aekiss avatar Feb 06 '23 04:02 aekiss