polaris.mesh.connectivity.label_regions

polaris.mesh.connectivity.label_regions(ds_mesh, cell_mask, link_mask=None)[source]

Label the connected regions of a domain.

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

  • cell_mask (numpy.ndarray or xarray.DataArray) – A boolean mask on cells that is True for cells in the domain

  • link_mask (numpy.ndarray, optional) – A boolean array of shape (nCells, maxEdges) selecting the local edges that connect cells. The default connects every active edge, as in connected_to_seeds().

Returns:

label (numpy.ndarray) – An integer array of shape (nCells,) giving each cell of the domain the label of its region, and -1 to cells outside the domain. Labels are not contiguous.