xrspatial.hydro.flow_path_d8.flow_path_d8#

xrspatial.hydro.flow_path_d8.flow_path_d8(flow_dir: DataArray, start_points: DataArray, name: str = 'flow_path') DataArray[source]#

Trace downstream flow paths from start points through a D8 grid.

Parameters:
  • flow_dir (xarray.DataArray or xr.Dataset) – 2D D8 flow direction grid (codes 0/1/2/4/8/16/32/64/128; NaN for nodata).

  • start_points (xarray.DataArray) – 2D raster where non-NaN cells are path starting locations. Values are preserved as labels along the traced path.

  • name (str, default 'flow_path') – Name of output DataArray.

Returns:

Same-shape grid where each cell on a traced path carries the label of its originating start point. All other cells are NaN. If paths overlap, the last start point in raster-scan order wins.

Return type:

xarray.DataArray or xr.Dataset