diff --git a/compass/ocean/tests/utility/combine_topo/__init__.py b/compass/ocean/tests/utility/combine_topo/__init__.py index 091419c54b..173253ba5e 100644 --- a/compass/ocean/tests/utility/combine_topo/__init__.py +++ b/compass/ocean/tests/utility/combine_topo/__init__.py @@ -170,13 +170,10 @@ def _modify_bedmachine(self): grounded_mask = np.logical_or(np.logical_or(mask == 1, mask == 2), mask == 4).astype(float) - bedmachine['bathymetry'] = bedmachine.bed.where(ocean_mask, 0.) - bedmachine['ice_draft'] = \ - (bedmachine.surface - - bedmachine.thickness).where(ocean_mask, 0.) + bedmachine['bathymetry'] = bedmachine.bed + bedmachine['ice_draft'] = bedmachine.surface - bedmachine.thickness bedmachine.ice_draft.attrs['units'] = 'meters' - bedmachine['thickness'] = \ - bedmachine.thickness.where(ocean_mask, 0.) + bedmachine['thickness'] = bedmachine.thickness bedmachine['ice_mask'] = ice_mask bedmachine['grounded_mask'] = grounded_mask @@ -231,11 +228,6 @@ def _remap_bedmachine(self): logger = self.logger logger.info('Remap BedMachineAntarctica to GEBCO 1/80 deg grid') - config = self.config - - section = config['combine_topo'] - renorm_thresh = section.getfloat('renorm_thresh') - in_filename = 'BedMachineAntarctica-v3_mod.nc' out_filename = 'BedMachineAntarctica_on_GEBCO_low.nc' gebco_filename = 'GEBCO_2023_0.0125_degree.nc' @@ -265,16 +257,6 @@ def _remap_bedmachine(self): for field in ['bathymetry', 'ice_draft', 'thickness']: bedmachine_on_gebco_low[field].attrs['unit'] = 'meters' - # renormalize the fields based on the ocean masks - ocean_mask = bedmachine_on_gebco_low.ocean_mask - - valid = ocean_mask > renorm_thresh - norm = ocean_mask.where(valid, 1.) - norm = 1. / norm - for field in ['bathymetry', 'ice_draft', 'thickness']: - bedmachine_on_gebco_low[field] = \ - norm * bedmachine_on_gebco_low[field].where(valid, 0.) - bedmachine_on_gebco_low.to_netcdf(out_filename) logger.info(' Done.') @@ -305,17 +287,22 @@ def _combine(self): bedmachine_bathy = bedmachine.bathymetry valid = bedmachine_bathy.notnull() bedmachine_bathy = bedmachine_bathy.where(valid, 0.) + bedmachine_bathy = bedmachine_bathy.where(bedmachine_bathy < 0., 0.) combined['bathymetry'] = \ - alpha * gebco.bathymetry.where(gebco.bathymetry < 0, 0.) + \ + alpha * gebco.bathymetry.where(gebco.bathymetry < 0., 0.) + \ (1.0 - alpha) * bedmachine_bathy + bathy_mask = xr.where(combined.bathymetry < 0., 1.0, 0.0) + for field in ['ice_draft', 'thickness']: - combined[field] = bedmachine[field] + combined[field] = bathy_mask * bedmachine[field] for field in ['bathymetry', 'ice_draft', 'thickness']: combined[field].attrs['unit'] = 'meters' - fill = {'ice_mask': 0., 'grounded_mask': 0., - 'ocean_mask': combined['bathymetry'] < 0.} + combined['bathymetry_mask'] = bathy_mask + + fill = {'ice_draft': 0., 'thickness': 0., 'ice_mask': 0., + 'grounded_mask': 0., 'ocean_mask': combined.bathymetry_mask} for field, fill_val in fill.items(): valid = bedmachine[field].notnull() diff --git a/compass/ocean/tests/utility/combine_topo/combine_topo.cfg b/compass/ocean/tests/utility/combine_topo/combine_topo.cfg index 28c94f0fe3..f8d9cc2ec9 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_20240323.nc +cobined_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240611.nc # the target and minimum number of MPI tasks to use in remapping ntasks = 512 @@ -15,7 +15,3 @@ min_tasks = 128 # latitudes between which the topography datasets get blended latmin = -62. latmax = -60. - -# the threshold for masks below which interpolated variables are not -# renormalized -renorm_thresh = 1e-3