xrspatial.hydro.flow_length_mfd.flow_length_mfd#
- xrspatial.hydro.flow_length_mfd.flow_length_mfd(flow_dir_mfd: DataArray, direction: str = 'downstream', name: str = 'flow_length_mfd') DataArray[source]#
Compute flow length from an MFD flow direction grid.
- Parameters:
flow_dir_mfd (xarray.DataArray or xr.Dataset) – 3-D MFD flow direction array of shape
(8, H, W)as returned byflow_direction_mfd. Values are flow fractions in[0, 1]that sum to 1.0 at each cell (0.0 at pits/flats, NaN at edges or nodata cells). Supported backends: NumPy, CuPy, NumPy-backed Dask, CuPy-backed Dask. If a Dataset is passed, the operation is applied to each data variable independently.direction (str, default 'downstream') –
'downstream': proportion-weighted average distance from each cell to its outlet. Each cell gets the expected distance across all MFD flow paths.'upstream': longest path from any divide to each cell.name (str, default 'flow_length_mfd') – Name of output DataArray.
- Returns:
2-D float64 array of flow length values in coordinate units. NaN where the input has NaN.
- Return type:
xarray.DataArray or xr.Dataset
References
Qin, C., Zhu, A.X., Pei, T., Li, B., Zhou, C., and Yang, L. (2007). An adaptive approach to selecting a flow-partition exponent for a multiple-flow-direction algorithm. International Journal of Geographical Information Science, 21(4), 443-458.
Quinn, P., Beven, K., Chevallier, P., and Planchon, O. (1991). The prediction of hillslope flow paths for distributed hydrological modelling using digital terrain models. Hydrological Processes, 5(1), 59-79.