pygeoprocessing.routing.watershed module

pygeoprocessing.routing.watershed.delineate_watersheds_d8()

Delineate watersheds for a vector of geometries using D8 flow dir.

Parameters
  • d8_flow_dir_raster_path_band (tuple) – A (path, band_id) tuple to a D8 flow direction raster. This raster must be a tiled raster with block sizes being a power of 2.

  • outflow_vector_path (str) – The path to a vector on disk containing features with valid geometries from which watersheds will be delineated. Only those parts of the geometry that overlap valid flow direction pixels will be included in the output watersheds vector.

  • target_watersheds_vector_path (str) – The path to a vector on disk where the target watersheds will be stored. Must have the extension .gpkg.

  • working_dir=None (str or None) – The path to a directory on disk within which various intermediate files will be stored. If None, a folder will be created within the system’s temp directory.

  • write_diagnostic_vector=False (bool) – If True, a set of vectors will be written to working_dir, one per watershed. Each vector includes geometries for the watershed being represented and for the watershed seed pixels the geometry overlaps. Useful in debugging issues with feature overlap of the DEM. Setting this parameter to True will dramatically increase runtime when outflow geometries cover many pixels.

  • remove_temp_files=True (bool) – Whether to remove the created temp directory at the end of the watershed delineation run.

  • target_layer_name='watersheds' (str) – The string name to use for the watersheds layer. This layer name may be named anything except for “polygonized_watersheds”.

Returns

None