polaris.tasks.e3sm.init.topo.cull.consistency.check_critical_passages

polaris.tasks.e3sm.init.topo.cull.consistency.check_critical_passages(ocean_cull_mask, ds_transects, logger, dead_end_mask=None, max_cells=10)[source]

Check that no cell on a critical ocean passage was culled from the ocean.

A critical passage exists to keep a strait open that the topography alone would close, so a cell removed from one is a passage that the mesh cannot support: either it is too coarse to resolve the strait, or the transect wanders onto land. Either way the transect is the thing to fix, so the error names it.

Dead ends of the candidate ocean are the exception. They form cul-de-sacs, so removing one cannot close a passage; a passage cell among them leads nowhere on this mesh, for example into a bay that is a single cell.

Parameters:
  • ocean_cull_mask (xarray.DataArray or numpy.ndarray) – The final ocean cull mask on base-mesh cells (1 where cells are culled, 0 where they are kept)

  • ds_transects (xarray.Dataset) – The widened critical ocean transects, with transectCellMasks and transectNames

  • logger (logging.Logger) – The logger for summary output

  • dead_end_mask (xarray.DataArray or numpy.ndarray, optional) – The dead ends of the candidate ocean (1 for dead ends, 0 elsewhere), whose removal from a passage is not counted

  • max_cells (int, optional) – The maximum number of offending cell indices to report per transect

Raises:

ValueError – If any critical passage lost a cell