xrspatial.hydro.hand_d8.hand_d8#
- xrspatial.hydro.hand_d8.hand_d8(flow_dir: DataArray, flow_accum: DataArray, elevation: DataArray, threshold: float = 100, name: str = 'hand') DataArray[source]#
Compute Height Above Nearest Drainage (HAND).
For each cell, follows the D8 flow direction downstream to the nearest stream cell (flow_accum >= threshold), then computes HAND = elevation - drain_elevation.
- Parameters:
flow_dir (xarray.DataArray) – 2D D8 flow direction grid.
flow_accum (xarray.DataArray) – 2D flow accumulation grid.
elevation (xarray.DataArray) – 2D elevation grid.
threshold (float, default 100) – Minimum flow accumulation to define a stream cell.
name (str, default 'hand') – Name of output DataArray.
- Returns:
2D float64 HAND grid. Stream cells have HAND = 0. NaN where flow_dir is NaN.
- Return type:
xarray.DataArray