Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set more topographic variables in critical passages #847

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set more topographic variables in critical passages
We need to set all land-ice related variables to zero in critical
passages:

* landIceFracObserved (currently the case)
* landIcePressureObserved
* landIceDraftObserved
* landIceGroundedFracObserved
* landIceFloatingFracObserved
* landIceThkObserved

We also need to set `oceanFracObserved` to one.
xylar committed Jul 24, 2024
commit 27b5f58b698462d4617fe7488efecf36b1bebff3
12 changes: 8 additions & 4 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
@@ -529,15 +529,19 @@ def _add_land_ice_mask_and_mask_draft(ds_topo, ds_base_mesh,
ds_map_culled_to_base, ds_perserve,
logger, latitude_threshold, sweep_count):

land_ice_frac = ds_topo.landIceFracObserved
# we don't what land ice where we are preserving critical passages
for ds in ds_perserve:
not_preserve = ds.transectCellMasks.sum(dim='nTransects') == 0
land_ice_frac = land_ice_frac.where(not_preserve, 0.0)

land_ice_frac.to_netcdf('land_ice_frac_without_critical_passages.nc')
for var in ['landIceFracObserved', 'landIcePressureObserved',
'landIceDraftObserved', 'landIceGroundedFracObserved',
'landIceFloatingFracObserved', 'landIceThkObserved']:
ds_topo[var] = ds_topo[var].where(not_preserve, 0.0)

ds_topo['oceanFracObserved'] = \
ds_topo['oceanFracObserved'].where(not_preserve, 1.0)

ds_topo['landIceFracObserved'] = land_ice_frac
land_ice_frac = ds_topo.landIceFracObserved

# we want the mask to be 1 where there's at least half land-ice
land_ice_mask = xr.where(land_ice_frac > 0.5, 1, 0)