xrspatial.hydro.flow_direction_dinf.flow_direction_dinf#
- xrspatial.hydro.flow_direction_dinf.flow_direction_dinf(agg: DataArray, name: str = 'flow_direction_dinf', boundary: str = 'nan') DataArray[source]#
Compute D-infinity flow direction for each cell.
Determines flow direction as a continuous angle toward the steepest downslope facet, following the Tarboton (1997) algorithm. The 3x3 neighborhood is divided into 8 triangular facets; the steepest downslope plane gives the flow angle.
- Parameters:
agg (xarray.DataArray or xr.Dataset) – 2D NumPy, CuPy, NumPy-backed Dask, or CuPy-backed Dask xarray DataArray of elevation values. If a Dataset is passed, the operation is applied to each data variable independently.
name (str, default='flow_direction_dinf') – Name of output DataArray.
boundary (str, default='nan') – How to handle edges where the kernel extends beyond the raster.
'nan'- fill missing neighbours with NaN (default).'nearest'- repeat edge values.'reflect'- mirror at boundary.'wrap'- periodic / toroidal.
- Returns:
2D array of continuous flow direction angles in radians. Valid values are in the range
[0, 2*pi).-1.0indicates a pit or flat with no downslope neighbor. Edge cells and cells with NaN in their 3x3 window are NaN.- Return type:
xarray.DataArray or xr.Dataset
References
Tarboton, D.G. (1997). A new method for the determination of flow directions and upslope areas in grid digital elevation models. Water Resources Research, 33(2), 309-319.