hydromt_sfincs.workflows.downscaling.remove_disconnected_flooding#

hydromt_sfincs.workflows.downscaling.remove_disconnected_flooding(depth_fn: ~pathlib.Path | str, bnd_fn: ~pathlib.Path | str, hmin: float = 0.02, connection_fn: ~pathlib.Path | str = None, output_fns: dict = None, logger=<Logger hydromt.hydromt_sfincs.workflows.downscaling (WARNING)>)[source]#

Remove disconnected flooding from a downscaled depth raster.

Identifies wet pixels reachable from SFINCS boundary points via BFS flood-fill (8-connectivity), then masks pixels that are wet but unreachable. Removes the need for a manually drawn source polygon.

Uses a vectorised level-set BFS instead of scipy.ndimage.label to avoid allocating a full int64 label array, which can exceed available memory for large high-resolution domains.

Parameters:
  • depth_fn (Path or str) – Path to the downscaled flood-depth GeoTIFF.

  • bnd_fn (Path or str) – Path to the SFINCS boundary point file (sfincs.bnd). Each point marks a location where water enters the domain.

  • hmin (float, optional) – Minimum water depth (m) to be considered wet, by default 0.02.

  • connection_fn (Path or str, optional) – If provided, a connection-mask GeoTIFF is written here with values: 0 = dry, 1 = connected to boundary, 2 = disconnected (wet but unreachable from any boundary point).

  • output_fns (dict, optional) – Dictionary of {input_fn: output_fn} pairs. For each pair the input raster is read, pixels where connection != 1 are set to NaN, and the result is written to output_fn.

  • logger (logging.Logger, optional) – Logger instance.

Return type:

None