hydromt_sfincs.workflows.downscaling.adjust_zsmax_dilation#
- hydromt_sfincs.workflows.downscaling.adjust_zsmax_dilation(zsmax: UgridDataArray | DataArray, factor: float) UgridDataArray | DataArray[source]#
Cell-space WSE dilation pre-step — works on both quadtree and regular grids.
For each already-wet cell/pixel, raise its zsmax to the max of (own, wet-neighbour values) within a radius of
(0.5 + factor)cell widths. Dry cells stay dry — the wet-cell set is preserved (key safeguard: no new cells are flooded).Typical use is to close 1 m-DEM connectivity gaps behind coarse-cell levees, where the parent cell’s single WSE sits below the levee crest on the fine DEM. Expanding each cell’s WSE plateau by a modest fraction of its own size lets the flood cross the crest continuously without introducing new wet cells elsewhere.
- Parameters:
zsmax (
xu.UgridDataArrayorxr.DataArray) – Maximum water level (m). NaN where dry. Quadtree grids are dispatched to a cKDTree-based implementation on the cell centres; regular grids to ascipy.ndimage.maximum_filterwith a disk footprint in pixel units.factor (
float) – Fraction of cell size.factor=0picks up only the cell itself on a uniform grid;factor=0.5reaches the 4 edge-neighbours;factor=1.0reaches ~1.5 cell widths (full 3×3 stencil on a uniform grid). Must be>= 0. Returned unchanged whenfactor <= 0.
- Returns:
Dilated zsmax on the same grid and with the same wet-cell set as the input.
dilated >= zsmaxon every wet cell.- Return type:
xu.UgridDataArrayorxr.DataArray