xrspatial.hydro.snap_pour_point_d8.snap_pour_point_d8#
- xrspatial.hydro.snap_pour_point_d8.snap_pour_point_d8(flow_accum: DataArray, pour_points: DataArray, search_radius: int = 5, name: str = 'snapped_pour_points') DataArray[source]#
Snap pour points to the highest-accumulation cell within a radius.
- Parameters:
flow_accum (xarray.DataArray or xr.Dataset) – 2D flow accumulation grid.
pour_points (xarray.DataArray) – 2D raster where non-NaN cells mark pour points (same format as
watershed()expects). Values are preserved as labels.search_radius (int, default 5) – Maximum search distance in pixels (Euclidean).
name (str, default 'snapped_pour_points') – Name of output DataArray.
- Returns:
Same-shape grid with pour point labels moved to their snapped locations. Non-pour-point cells are NaN.
- Return type:
xarray.DataArray or xr.Dataset