xrspatial.hydro.stream_link_mfd.stream_link_mfd#
- xrspatial.hydro.stream_link_mfd.stream_link_mfd(fractions: DataArray, flow_accum: DataArray, threshold: float = 100, name: str = 'stream_link_mfd') DataArray[source]#
Assign unique IDs to stream link segments (MFD).
Each contiguous stream segment between junctions, headwaters, and outlets receives a distinct positive integer ID. Non-stream cells are NaN.
- Parameters:
fractions (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 (NaN at nodata cells). The neighbor order is: E(0), SE(1), S(2), SW(3), W(4), NW(5), N(6), NE(7).flow_accum (xarray.DataArray) – 2-D flow accumulation grid. Cells with
flow_accum >= thresholdare stream cells.threshold (float, default 100) – Minimum accumulation for stream classification.
name (str, default 'stream_link_mfd') – Name of output DataArray.
- Returns:
2-D float64 grid where each stream link has a unique positive integer ID. Non-stream cells are NaN.
- Return type:
xarray.DataArray or xr.Dataset