hydromt_sfincs.workflows.downscaling.adjust_zsmax_energyhead#
- hydromt_sfincs.workflows.downscaling.adjust_zsmax_energyhead(zsmax: DataArray | UgridDataArray, qmax: DataArray | UgridDataArray, zb: DataArray | UgridDataArray | None = None, hmin: float = 0.05, q_threshold: float = 0.01) DataArray | UgridDataArray[source]#
Add the velocity head v²/(2g) to zsmax (Bernoulli correction).
Lifts the water level on wet cells where the unit discharge exceeds
q_threshold, converting zsmax to the total-energy headH = zsmax + v² / (2g). The wet-cell set is preserved: NaN cells stay NaN.This is a method-agnostic pre-step — the returned DataArray can be consumed by any downscaling method (constant, bilinear, raw, etc.). Works on both SFINCS quadtree grids (
xu.UgridDataArray) and regular grids (xr.DataArray);zsmax,qmax, andzbmust all share the same grid.- Parameters:
zsmax (
xu.UgridDataArrayorxr.DataArray) – Maximum water level (m) on a SFINCS grid — quadtree (xu.UgridDataArray) or regular (xr.DataArray). NaN where dry.qmax (
xu.UgridDataArrayorxr.DataArray) – Maximum unit discharge magnitude (m²/s), cell-centred — one value per cell, with the same shape and grid aszsmax. This is the convention SFINCS writes tosfincs_map.nc(variableqmax) whenstorefluxmax=1; no face-to-centre reduction is needed. The sign is ignored (|qmax|is used internally). Formula:vel_head = q² / (h² · 2g)withh = max(zsmax - zb, hmin).zb (
xu.UgridDataArrayorxr.DataArray, optional) – Bed elevation (m) at cell centres, used to estimate depth. If omitted, a constant depth ofhminis assumed (conservative — overestimates velocity and therefore the head correction).hmin (
float, optional) – Minimum depth (m) for velocity estimation, by default 0.05.q_threshold (
float, optional) – Minimum unit discharge magnitude (m²/s) to apply the correction, by default 0.01. Cells below this threshold keep their original zsmax.
- Returns:
zsmax with the velocity head added on qualifying cells. Same grid and same wet-cell set as the input.
result >= zsmaxon every wet cell (velocity head is always non-negative).- Return type:
xu.UgridDataArrayorxr.DataArray