compass.landice.mesh.gridded_flood_fill

compass.landice.mesh.gridded_flood_fill(field, iStart=None, jStart=None)[source]

Uses a flood fill to fill disconnected regions. Any disconnected regions are set to 0. This version uses scipy.ndimage.label() to identify connected components of field > 0, then keeps only the component containing the seed point.

Parameters:
  • field (ndarray) – Input 2D field. Cells with field > 0 are considered fillable.

  • iStart (int, optional) – Seed location. If not provided, defaults to the center of the array.

  • jStart (int, optional) – Seed location. If not provided, defaults to the center of the array.

Returns:

flood_mask (ndarray) – Integer mask with 1 for the connected component containing the seed, and 0 elsewhere.