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.labelto avoid allocating a full int64 label array, which can exceed available memory for large high-resolution domains.- Parameters:
depth_fn (
Pathorstr) – Path to the downscaled flood-depth GeoTIFF.bnd_fn (
Pathorstr) – 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 (
Pathorstr, 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 whereconnection != 1are set to NaN, and the result is written to output_fn.logger (
logging.Logger, optional) – Logger instance.
- Return type: