xrspatial.flood.flood_depth#
- xrspatial.flood.flood_depth(hand_agg: DataArray, water_level: float, name: str = 'flood_depth') DataArray[source]#
Compute flood depth from a HAND raster and a water level.
depth = water_level - HANDwhereHAND <= water_level,NaNelsewhere.- Parameters:
hand_agg (xarray.DataArray) – 2D Height Above Nearest Drainage raster (output of
hand()).water_level (float) – Water surface elevation above the drainage network (>= 0).
name (str, default 'flood_depth') – Name of the output DataArray.
- Returns:
2D float64 grid of flood depths.
NaNwhere not inundated or where the input isNaN.- 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 >>> hand = xr.DataArray( ... np.array([[0.0, 2.0], [5.0, 10.0]]), dims=['y', 'x']) >>> depth = flood_depth(hand, water_level=5.0)