easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.basin_delineation
Basin and subbasin delineation helpers based on flow-direction rasters.
Functions
|
Delineate all edge-draining basins from a flow-direction raster. |
|
Delineate basins for user-provided snapped outlet points. |
|
Delineate subbasins draining to each stream link. |
|
Repair invalid basin-vector geometries using |
- easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.basin_delineation.delineate_basins_for_snaped_outlets(wbe, flow_direction, snaped_outlets_vector, output_file_basins_raster='basins_raster.tif', output_file_basins_vector='basins_vector.shp', smooth_vector=False, smooth_filter_size=5, esri_pointer=True)[source]
Delineate basins for user-provided snapped outlet points.
- Parameters:
wbe (WbEnvironment) – WhiteboxTools workflow environment instance.
flow_direction (WbRaster) – D8 flow direction raster (path or object). Values should follow WhiteboxTools D8 encoding (0=East, 1=NE, 2=North, etc.).
snaped_outlets_vector (WbVector) – Vector file containing snapped outlet points.
output_file_basins_raster (str, optional) – Output path for basins raster (default “basins_raster.tif”).
output_file_basins_vector (str, optional) – Output path for basins vector (default “basins_vector.shp”).
smooth_vector (bool, optional) – Whether to smooth output vector polygons (default False). Note: smooth_vector may cause edges to not align properly.
smooth_filter_size (int, optional) – Size of smoothing filter (default 5).
esri_pointer (bool, optional) – Whether flow direction uses ESRI pointer convention (default True).
- Returns:
(basins_raster, basins_vector).- Return type:
tuple
- easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.basin_delineation.delineate_all_basins(wbe, flow_direction, output_file_all_basins_raster='all_basins_raster.tif', output_file_all_basins_vector='all_basins_vector.shp', smooth_vector=True, smooth_filter_size=5, esri_pointer=True)[source]
Delineate all edge-draining basins from a flow-direction raster.
- Parameters:
wbe (WbEnvironment) – WhiteboxTools workflow environment instance.
flow_direction (WbRaster) – D8 flow direction raster (path or object). Values should follow WhiteboxTools D8 encoding (0=East, 1=NE, 2=North, etc.).
output_file_all_basins_raster (str, optional) – Output path for basins raster (default “all_basins_raster.tif”).
output_file_all_basins_vector (str, optional) – Output path for basins vector (default “all_basins_vector.shp”).
smooth_vector (bool, optional) – Whether to smooth output vector polygons (default True).
smooth_filter_size (int, optional) – Size of smoothing filter (default 5).
esri_pointer (bool, optional) – Whether flow direction uses ESRI pointer convention (default True).
- Returns:
(all_basins_raster, all_basins_vector).- Return type:
tuple
- easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.basin_delineation.delineate_subbasins(wbe, flow_direction, stream_raster, output_file_subbasins_raster='subbasins_raster.tif', output_file_subbasins_vector='subbasins_vector.shp', smooth_vector=True, smooth_filter_size=5, esri_pointer=True)[source]
Delineate subbasins draining to each stream link.
- Parameters:
wbe (WbEnvironment) – WhiteboxTools workflow environment instance.
flow_direction (WbRaster) – D8 flow direction raster (path or object). Values should follow WhiteboxTools D8 encoding (0=East, 1=NE, 2=North, etc.).
stream_raster (WbRaster) – Extracted stream raster (binary).
output_file_subbasins_raster (str, optional) – Output path for subbasins raster (default “subbasins_raster.tif”).
output_file_subbasins_vector (str, optional) – Output path for subbasins vector (default “subbasins_vector.shp”).
smooth_vector (bool, optional) – Whether to smooth output vector polygons (default True).
smooth_filter_size (int, optional) – Size of smoothing filter (default 5).
esri_pointer (bool, optional) – Whether flow direction uses ESRI pointer convention (default True).
- Returns:
(subbasins_raster, subbasins_vector).- Return type:
tuple
- easy_vic_build.tools.hydroanalysis_func.hydroanalysis_wbw.basin_delineation.repair_basins_vector(basins_vector_path, output_file_basins_vector_path='repaired_basins_vector.shp')[source]
Repair invalid basin-vector geometries using
make_valid.- Parameters:
basins_vector_path (str) – Path to the input vector file (e.g., Shapefile, GeoJSON) containing basin polygons.
output_file_basins_vector_path (str, optional) – Output path placeholder. The current implementation does not write to file.
- Returns:
GeoDataFrame with repaired geometries.
- Return type:
gpd.GeoDataFrame