hydromt_sfincs.workflows.downscaling.downscale_floodmap#
- hydromt_sfincs.workflows.downscaling.downscale_floodmap(zsmax: ~xarray.core.dataarray.DataArray | ~xugrid.core.wrap.UgridDataArray, dep: ~pathlib.Path | str | ~xarray.core.dataarray.DataArray, reproj_method: str = 'nearest', subtract_dem: bool = True, indices: ~pathlib.Path | str | ~xarray.core.dataarray.DataArray = None, hmin: float = 0.05, gdf_mask: ~geopandas.geodataframe.GeoDataFrame = None, floodmap_fn: ~pathlib.Path | str = None, zsmap_fn: ~pathlib.Path | str = None, zoom_level: int | tuple | None = None, nrmax: int = 2000, logger=<Logger hydromt.hydromt_sfincs.workflows.downscaling (WARNING)>, **kwargs)[source]#
Create a downscaled floodmap for (model) region.
The downscaler assigns every high-resolution DEM pixel a water-surface elevation (WSE) interpolated from the SFINCS
zsmaxfield and — by default — subtracts the DEM to obtain flood depth. Its behaviour is set by two orthogonal knobs:reproj_method– how the WSE is interpolated onto the DEM grid:"nearest"(each pixel takes the WSE of the SFINCS cell that contains it — the classic bathtub) or"bilinear"(interpolate between surrounding cell centres, Sanders & Schubert 2019).subtract_dem– whenTrue(default) the DEM is subtracted to return flood depthhmax; whenFalsethe raw interpolated water level is returned (no DEM subtraction, nohminmasking).
WSE pre-adjustments (cell-space dilation, Bernoulli velocity head) are not part of this function — call
adjust_zsmax_dilation()/adjust_zsmax_energyhead()onzsmaxbeforehand if needed.- Parameters:
zsmax (
xr.DataArrayorxu.UgridDataArray) – Maximum water level (m). When multiple timesteps are present the maximum over all timesteps is used.dep (
Path,str, orxr.DataArray) – High-resolution DEM (m) of the model region.reproj_method (
{"nearest", "bilinear"}, optional) – WSE interpolation onto the DEM grid, by default"nearest". On a regular grid"bilinear"uses the reproject engine; on a quadtree it uses a scattered interpolator over the cell centres.subtract_dem (
bool, optional) – Subtract the DEM to return flood depth (True, default) or return the raw interpolated water level (False).indices (
Path,str, orxr.DataArray, optional) – Pre-computed cell-index raster (exact containment; used forreproj_method="nearest"and to mask pixels outside the domain).hmin (
float, optional) – Minimum water depth (m) to be considered flooded, by default 0.05. Ignored whensubtract_demisFalse.gdf_mask (
gpd.GeoDataFrame, optional) – Polygons to mask the output (area outside is set to NaN).floodmap_fn (
Pathorstr, optional) – Output flood-depth GeoTIFF. Required (for file input) whensubtract_demisTrue.zsmap_fn (
Pathorstr, optional) – Output water-level GeoTIFF. Required (for file input) whensubtract_demisFalse.zoom_level (
intortuple, optional) – Overview level of the raster dataset (regular-grid nearest only).nrmax (
int, optional) – Block size in pixels, by default 2000.logger (
logging.Logger, optional) – Logger instance.kwargs (
dict, optional) – Extra keyword arguments forwarded toRasterDataArray.to_raster(only for the in-memory path).
- Returns:
The downscaled product: flood depth (
hmax) whensubtract_demisTrue, otherwise the water level. Dry pixels are NaN (a domain with no flooding yields an all-NaN array). File-based calls also write it to floodmap_fn / zsmap_fn and return a lazy (dask-backed) view re-opened from that file; the in-memory path returns the array directly.- Return type:
xr.DataArray