xrspatial.flood.flood_depth_vegetation#
- xrspatial.flood.flood_depth_vegetation(hand_agg: DataArray, slope_agg: DataArray, mannings_n: float | DataArray, unit_discharge: float, name: str = 'flood_depth_vegetation') DataArray[source]#
Compute vegetation-adjusted flood depth via Manning’s normal depth.
For each cell, the equilibrium (normal) depth for steady uniform flow is:
h = (q * n / sqrt(tan(slope)))^(3/5)
where q is unit discharge (m^2/s), n is Manning’s roughness, and slope is terrain slope in degrees. The flood depth is
h - HANDwhereh > HAND, and NaN elsewhere.Higher roughness (denser vegetation) produces deeper, slower water.
- Parameters:
hand_agg (xarray.DataArray) – 2D HAND raster (output of
hand()).slope_agg (xarray.DataArray) – 2D slope raster in degrees.
mannings_n (float or xarray.DataArray) – Manning’s roughness coefficient. A scalar applies uniformly; a DataArray (e.g. output of
vegetation_roughness()) allows spatially varying roughness.unit_discharge (float) – Unit discharge in m^2/s (discharge per unit width, > 0).
name (str, default 'flood_depth_vegetation') – Name of the output DataArray.
- Returns:
2D float64 flood depth grid. NaN where not inundated or where inputs are NaN.
- Return type:
xarray.DataArray
Notes
Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed xarray DataArrays.
Examples
>>> import numpy as np >>> import xarray as xr >>> from xrspatial import flood_depth_vegetation >>> hand = xr.DataArray( ... np.array([[0.0, 1.0]]), dims=['y', 'x']) >>> slope = xr.DataArray( ... np.array([[10.0, 10.0]]), dims=['y', 'x']) >>> depth = flood_depth_vegetation( ... hand, slope, mannings_n=0.10, unit_discharge=0.5)