Skip to content

Commit

Permalink
Renormalize bathymetry based on sea-level mask
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Jun 11, 2024
1 parent b7b990e commit f9843fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion compass/ocean/mesh/remap_topography.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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_20230831.nc
topo_filename = BedMachineAntarctica_v3_and_GEBCO_2023_0.0125_degree_20240611.nc

# variable names in topo_filename
lon_var = lon
Expand All @@ -12,6 +12,7 @@ ice_thickness_var = thickness
ice_frac_var = ice_mask
grounded_ice_frac_var = grounded_mask
ocean_frac_var = ocean_mask
bathy_frac_var = bathymetry_mask

# the description to include in metadata
description = Bathymetry is from GEBCO 2023, combined with BedMachine
Expand Down
8 changes: 5 additions & 3 deletions compass/ocean/mesh/remap_topography.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def run(self):
'ice_thickness_var': 'landIceThkObserved',
'ice_frac_var': 'landIceFracObserved',
'grounded_ice_frac_var': 'landIceGroundedFracObserved',
'ocean_frac_var': 'oceanFracObserved'}
'ocean_frac_var': 'oceanFracObserved',
'bathy_frac_var': 'bathyFracObserved'}

for option, out_var in rename.items():
in_var = config.get('remap_topography', option)
Expand All @@ -146,11 +147,12 @@ def run(self):

# make sure fractions don't exceed 1
for var in ['landIceFracObserved', 'landIceGroundedFracObserved',
'landIceFloatingFracObserved', 'oceanFracObserved']:
'landIceFloatingFracObserved', 'oceanFracObserved',
'bathyFracObserved']:
ds_out[var] = np.minimum(ds_out[var], 1.)

# renormalize elevation variables
norm = ds_out.oceanFracObserved
norm = ds_out.bathyFracObserved
valid = norm > renorm_threshold
for var in ['bed_elevation', 'landIceThkObserved']:
ds_out[var] = xr.where(valid, ds_out[var] / norm, 0.)
Expand Down
1 change: 1 addition & 0 deletions compass/ocean/tests/global_ocean/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def configure(self, config=None):
description = 'Bathymetry is from GEBCO 2022, combined with ' \
'BedMachine Antarctica v2 around Antarctica.'
config.set('remap_topography', 'topo_filename', filename)
config.set('remap_topography', 'bathy_frac_var', 'ocean_mask')
config.set('remap_topography', 'description', description)
config.set('remap_topography', 'ntasks', '64')
config.set('remap_topography', 'min_tasks', '4')
Expand Down

0 comments on commit f9843fe

Please sign in to comment.