Skip to content

Commit

Permalink
Fix masking of ice draft and ice thickness in combine_topo
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Aug 28, 2024
1 parent f7a7eb5 commit 06f42ec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions compass/ocean/tests/utility/combine_topo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 06f42ec

Please sign in to comment.