Skip to content

Commit

Permalink
Floodfill landIceFraction, not landIceMask
Browse files Browse the repository at this point in the history
During the `cull_mesh` step of creating a global ocean mesh,
if ice-shelf cavities are present, we need to flood fill to make
sure all land ice is connected (no islands of isolated land ice).
This merge changes the flood fill to be on all locations where
`landIceFraction > 0`, not all locations where `landIceFraction > 0.5`.
It then masks all `landIce*` fields to only be nonzero within the
flood-filled region.  This prevents islands of nonzero
`landIceFraction`, `landIcePressure`, `landIceDraft`, etc.
  • Loading branch information
xylar committed Jul 30, 2024
1 parent 643ae69 commit 4b66796
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,22 +543,33 @@ def _add_land_ice_mask_and_mask_draft(ds_topo, ds_base_mesh,

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)
land_ice_present = xr.where(land_ice_frac > 0.0, 1, 0)

gf = GeometricFeatures()
fc_ocean_seed = gf.read(componentName='ocean', objectType='point',
tags=['seed_point'])

fc_south_pole_seed = read_feature_collection('south_pole.geojson')

# flood fill the ice portion to remove isolated land ice
# flood fill anywhere land ice is present to remove isolated land ice

ds_mask = compute_mpas_flood_fill_mask(dsMesh=ds_base_mesh,
daGrow=land_ice_mask,
daGrow=land_ice_present,
fcSeed=fc_south_pole_seed,
logger=logger)
land_ice_mask = ds_mask.cellSeedMask
land_ice_present = ds_mask.cellSeedMask

# update land-ice variables and ocean fraction accordingly
for var in ['landIceFracObserved', 'landIcePressureObserved',
'landIceDraftObserved', 'landIceGroundedFracObserved',
'landIceFloatingFracObserved', 'landIceThkObserved']:
ds_topo[var] = ds_topo[var].where(land_ice_present, 0.0)

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

land_ice_frac = ds_topo.landIceFracObserved
land_ice_mask = xr.where(land_ice_frac > 0.5, 1, 0)

# now, remove land-locked or land-ice-locked cells

Expand Down

0 comments on commit 4b66796

Please sign in to comment.