easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.outlet_detection

Outlet detection and snapping helpers for watershed delineation.

Functions

detect_main_outlet(flow_acc_path[, ...])

Detect the primary outlet from a flow-accumulation raster.

detect_outlets_with_reference(wbe, x_coords, ...)

Create outlet points from coordinates and snap them to streams.

snap_outlet_to_stream(wbe, ...[, output_file])

Snap outlet points to the nearest stream cell.

easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.outlet_detection.detect_main_outlet(flow_acc_path, output_file_path='main_outlet.shp', crs_str='EPSG:4326')[source]

Detect the primary outlet from a flow-accumulation raster.

Parameters:
  • flow_acc_path (str) – Path to the flow accumulation raster file.

  • output_file_path (str, optional) – Output path for the main outlet shapefile (default “main_outlet.shp”).

  • crs_str (str, optional) – Coordinate reference system string (default “EPSG:4326”).

Returns:

((x_coord, y_coord), (max_col, max_row)) where the first tuple is outlet coordinates and the second is raster index.

Return type:

tuple

easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.outlet_detection.snap_outlet_to_stream(wbe, outlet_vector_path, stream_raster, output_file='snaped_outlet.shp', **kwargs)[source]

Snap outlet points to the nearest stream cell.

Parameters:
  • wbe (WbEnvironment) – WhiteboxTools workflow environment instance.

  • outlet_vector_path (str) – Path to the outlet point vector file.

  • stream_raster (WbRaster) – Extracted stream raster (binary).

  • output_file (str, optional) – Output path for the snapped outlet shapefile (default "snaped_outlet.shp").

  • **kwargs (dict, optional) –

    Additional keyword arguments passed to jenson_snap_pour_points.
    • snap_dist: float

      Maximum snap distance for snapping outlets to streams.

Returns:

Snapped outlet vector object.

Return type:

WbVector

easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.outlet_detection.detect_outlets_with_reference(wbe, x_coords, y_coords, stream_raster, crs_str='EPSG:4326', output_file_path='outlets_with_reference.shp', snaped_output_file_path='snaped_outlets_with_reference.shp', **snap_outlet_to_stream_kwargs)[source]

Create outlet points from coordinates and snap them to streams.

Parameters:
  • wbe (WbEnvironment) – WhiteboxTools workflow environment instance.

  • x_coords (sequence of float) – X coordinates for outlet points.

  • y_coords (sequence of float) – Y coordinates for outlet points.

  • stream_raster (WbRaster) – Extracted stream raster (binary).

  • crs_str (str, optional) – Coordinate reference system string (default “EPSG:4326”).

  • output_file_path (str, optional) – Output path for initial outlet points shapefile (default “outlets_with_reference.shp”).

  • snaped_output_file_path (str, optional) – Output path for snapped outlet points shapefile (default “snaped_outlets_with_reference.shp”).

  • **snap_outlet_to_stream_kwargs (dict) –

    Additional keyword arguments forwarded to snap_outlet_to_stream.
    • snap_dist: float

      Maximum snap distance for snapping outlets to streams.

Returns:

(outlet_gdf, snaped_outlet_vector).

Return type:

tuple