polaris.tasks.e3sm.init.topo.cull.land_locked.remove_land_locked_cells

polaris.tasks.e3sm.init.topo.cull.land_locked.remove_land_locked_cells(ds_mesh, ocean_mask, no_cavities_mask, land_ice_mask, ocean_seed_mask, latitude_threshold, logger=None, max_iterations=100)[source]

Refine the ocean and ocean-without-cavities domains together, removing the cells in which the ocean cannot circulate and those in which sea ice would be trapped.

The two models make different demands on the mesh. MPAS-Ocean and Omega are C-grids with velocities at edges, so an ocean cell needs at least two active edges: a way in and a way out. MPAS-Seaice is a B-grid with velocities at vertices, so a sea-ice cell needs at least one active vertex, or ice drifting into it has no velocity point to leave by. The vertex criterion is the stronger of the two and applies only where sea ice can form.

The two domains are refined together rather than in sequence, because removing a cell from one can strand a cell in the other. Each pass only ever removes cells, so the alternation terminates.

Parameters:
  • ds_mesh (xarray.Dataset) – An MPAS mesh with cellsOnCell, nEdgesOnCell and latCell

  • ocean_mask (numpy.ndarray) – A boolean mask on cells, True for the candidate ocean domain

  • no_cavities_mask (numpy.ndarray) – A boolean mask on cells, True for the candidate ocean domain without ice-shelf cavities

  • land_ice_mask (numpy.ndarray) – A boolean mask on cells, True where land ice is present. Used to decide which cells may legitimately be in ocean but not in ocean_no_cavities

  • ocean_seed_mask (numpy.ndarray) – A boolean mask on cells, True at the seed cells for the ocean flood fill

  • latitude_threshold (float) – The latitude in degrees poleward of which sea ice can form

  • logger (logging.Logger, optional) – A logger for per-iteration counts

  • max_iterations (int, optional) – The maximum number of alternations before giving up

Returns:

  • ocean_mask (numpy.ndarray) – The refined ocean domain

  • no_cavities_mask (numpy.ndarray) – The refined ocean domain without ice-shelf cavities

Raises:

ValueError – If the sea-ice domain has no cells equatorward of the latitude threshold to seed its flood fill, or if the alternation fails to converge