diff --git a/latest/_modules/compass/ocean/mesh/cull.html b/latest/_modules/compass/ocean/mesh/cull.html index e51e4c711..758a79d81 100644 --- a/latest/_modules/compass/ocean/mesh/cull.html +++ b/latest/_modules/compass/ocean/mesh/cull.html @@ -565,7 +565,7 @@

Source code for compass.ocean.mesh.cull

 
     if has_remapped_topo:
         _cull_topo(with_cavities, process_count, logger, latitude_threshold,
-                   sweep_count)
+                   sweep_count, dsPreserve)
 
     if with_cavities:
         dsMask = xr.open_dataset('topography_culled.nc')
@@ -604,7 +604,7 @@ 

Source code for compass.ocean.mesh.cull

 
 
 def _cull_topo(with_cavities, process_count, logger, latitude_threshold,
-               sweep_count):
+               sweep_count, ds_preserve):
 
     ds_topo = xr.open_dataset('topography.nc')
     ds_base = xr.open_dataset('base_mesh.nc')
@@ -617,8 +617,9 @@ 

Source code for compass.ocean.mesh.cull

 
     if with_cavities:
         _add_land_ice_mask_and_mask_draft(ds_topo, ds_base,
-                                          ds_map_culled_to_base, logger,
-                                          latitude_threshold, sweep_count)
+                                          ds_map_culled_to_base, ds_preserve,
+                                          logger, latitude_threshold,
+                                          sweep_count)
         write_netcdf(ds_topo, 'topography_with_land_ice_mask.nc')
 
     logger.info('Culling topography')
@@ -653,9 +654,18 @@ 

Source code for compass.ocean.mesh.cull

 
 
 def _add_land_ice_mask_and_mask_draft(ds_topo, ds_base_mesh,
-                                      ds_map_culled_to_base, logger,
-                                      latitude_threshold, sweep_count):
+                                      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')
+
+    ds_topo['landIceFracObserved'] = land_ice_frac
 
     # 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)