From 06f42ec7db046a27406a34b2a408c28d8b246162 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 28 Aug 2024 05:48:49 -0500 Subject: [PATCH 1/3] Fix masking of ice draft and ice thickness in combine_topo --- compass/ocean/tests/utility/combine_topo/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compass/ocean/tests/utility/combine_topo/__init__.py b/compass/ocean/tests/utility/combine_topo/__init__.py index 173253ba5..788d8da43 100644 --- a/compass/ocean/tests/utility/combine_topo/__init__.py +++ b/compass/ocean/tests/utility/combine_topo/__init__.py @@ -299,14 +299,17 @@ def _combine(self): for field in ['bathymetry', 'ice_draft', 'thickness']: combined[field].attrs['unit'] = 'meters' + for field in ['ice_mask', 'grounded_mask', 'ocean_mask']: + combined[field] = bedmachine[field] + combined['bathymetry_mask'] = bathy_mask fill = {'ice_draft': 0., 'thickness': 0., 'ice_mask': 0., - 'grounded_mask': 0., 'ocean_mask': combined.bathymetry_mask} + 'grounded_mask': 0., 'ocean_mask': bathy_mask} for field, fill_val in fill.items(): - valid = bedmachine[field].notnull() - combined[field] = bedmachine[field].where(valid, fill_val) + valid = combined[field].notnull() + combined[field] = combined[field].where(valid, fill_val) combined['water_column'] = \ combined['ice_draft'] - combined['bathymetry'] From a06b08e1babcd7c87080f5f79dc9fac2ee49b13c Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 28 Aug 2024 05:58:34 -0500 Subject: [PATCH 2/3] Bump the datestamp on the topography file --- compass/ocean/mesh/remap_topography.cfg | 2 +- compass/ocean/tests/utility/combine_topo/combine_topo.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compass/ocean/mesh/remap_topography.cfg b/compass/ocean/mesh/remap_topography.cfg index de659dabd..34b4bcdd8 100644 --- a/compass/ocean/mesh/remap_topography.cfg +++ b/compass/ocean/mesh/remap_topography.cfg @@ -2,7 +2,7 @@ [remap_topography] # the name of the topography file in the bathymetry database -topo_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240611.nc +topo_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240828.nc # variable names in topo_filename lon_var = lon diff --git a/compass/ocean/tests/utility/combine_topo/combine_topo.cfg b/compass/ocean/tests/utility/combine_topo/combine_topo.cfg index f8d9cc2ec..51bd2f2d1 100644 --- a/compass/ocean/tests/utility/combine_topo/combine_topo.cfg +++ b/compass/ocean/tests/utility/combine_topo/combine_topo.cfg @@ -6,7 +6,7 @@ antarctic_filename = BedMachineAntarctica-v3.nc global_filename = GEBCO_2023.nc # the name of the output topography file, to be copied to the bathymetry database -cobined_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240611.nc +cobined_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240828.nc # the target and minimum number of MPI tasks to use in remapping ntasks = 512 From 3ddbaa1a4f4462fa8dc303c4a7040e6dceb541cd Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 28 Aug 2024 12:09:04 -0500 Subject: [PATCH 3/3] Fix ice thickness and pressure where above flotation We don't want ice thickness and pressure to exceed their flotation values. Previously, we were only making sure that ice draft did not exceed its flotation value (i.e. the draft was above the bed). --- compass/ocean/mesh/remap_topography.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compass/ocean/mesh/remap_topography.py b/compass/ocean/mesh/remap_topography.py index 0e0356220..788561fc3 100644 --- a/compass/ocean/mesh/remap_topography.py +++ b/compass/ocean/mesh/remap_topography.py @@ -158,16 +158,18 @@ def run(self): ds_out[var] = xr.where(valid, ds_out[var] / norm, 0.) thickness = ds_out.landIceThkObserved + bed = ds_out.bed_elevation + flotation_thickness = - (ocean_density / ice_density) * bed + # not allowed to be thicker than the flotation thickness + thickness = np.minimum(thickness, flotation_thickness) + ds_out['landIceThkObserved'] = thickness + ds_out['landIcePressureObserved'] = ice_density * g * thickness # compute the ice draft to be consistent with the land ice pressure # and using E3SM's density of seawater - draft = - (ice_density / ocean_density) * thickness - bed = ds_out.bed_elevation - - # can't be deeper than the bed - draft = xr.where(draft >= bed, draft, bed) - ds_out['landIceDraftObserved'] = draft + ds_out['landIceDraftObserved'] = \ + - (ice_density / ocean_density) * thickness write_netcdf(ds_out, 'topography_remapped.nc')