polaris.mesh.spherical.unified.effective_ocean.flood_fill_from_seeds

polaris.mesh.spherical.unified.effective_ocean.flood_fill_from_seeds(mask, lat, lon, seed_points)[source]

Keep the connected components of a mask that contain seed points.

Connectivity is 4-connected with periodic wrap in longitude.

Parameters:
  • mask (numpy.ndarray) – A boolean mask with dimensions (lat, lon)

  • lat (numpy.ndarray) – The latitude coordinate in degrees

  • lon (numpy.ndarray) – The longitude coordinate in degrees

  • seed_points (list of tuple) – (lon, lat) seed points in degrees

Returns:

filled (numpy.ndarray) – The mask restricted to components containing seed points