Skip to content

Commit

Permalink
Mask bathymetry, thickness, draft to below sea level
Browse files Browse the repository at this point in the history
Add a `bathymetry_mask` field to indicate where this has happened
  • Loading branch information
xylar committed Jun 11, 2024
1 parent 5b1bae6 commit 8b94d18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions compass/ocean/tests/utility/combine_topo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,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'

combined['bathymetry_mask'] = bathy_mask

fill = {'ice_draft': 0., 'thickness': 0., 'ice_mask': 0.,
'grounded_mask': 0., 'ocean_mask': combined['bathymetry'] < 0.}
'grounded_mask': 0., 'ocean_mask': combined.bathymetry_mask}

for field, fill_val in fill.items():
valid = bedmachine[field].notnull()
Expand Down
2 changes: 1 addition & 1 deletion compass/ocean/tests/utility/combine_topo/combine_topo.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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_20240610.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
Expand Down

0 comments on commit 8b94d18

Please sign in to comment.