# natcap.invest.routing package¶

## natcap.invest.routing.delineateit module¶

DelineateIt entry point for exposing pygeoprocessing’s watershed delineation routine to a UI.

natcap.invest.routing.delineateit.execute(args)

Delineateit: Watershed Delineation.

This ‘model’ provides an InVEST-based wrapper around the pygeoprocessing routing API for watershed delineation.

Upon successful completion, the following files are written to the output workspace:

• snapped_outlets.shp - an ESRI shapefile with the points snapped to a nearby stream.
• watersheds.shp - an ESRI shapefile of watersheds determined by the d-infinity routing algorithm.
• stream.tif - a GeoTiff representing detected streams based on the provided flow_threshold parameter. Values of 1 are streams, values of 0 are not.
Parameters: workspace_dir (string) – The selected folder is used as the workspace all intermediate and output files will be written.If the selected folder does not exist, it will be created. If datasets already exist in the selected folder, they will be overwritten. (required) results_suffix (string) – This text will be appended to the end of output files to help separate multiple runs. (optional) dem_uri (string) – A GDAL-supported raster file with an elevation for each cell. Make sure the DEM is corrected by filling in sinks, and if necessary burning hydrographic features into the elevation model (recommended when unusual streams are observed.) See the ‘Working with the DEM’ section of the InVEST User’s Guide for more information. (required) outlet_shapefile_uri (string) – This is a vector of points representing points that the watersheds should be built around. (required) flow_threshold (int) – The number of upstream cells that must into a cell before it’s considered part of a stream such that retention stops and the remaining export is exported to the stream. Used to define streams from the DEM. (required) snap_distance (int) – Pixel Distance to Snap Outlet Points (required) None

## natcap.invest.routing.routedem module¶

RouteDEM entry point for exposing the natcap.invest’s routing package to a UI.

natcap.invest.routing.routedem.execute(args)

RouteDEM: D-Infinity Routing.

This model exposes the pygeoprocessing d-infinity routing functionality in the InVEST model API.

Parameters: workspace_dir (string) – The selected folder is used as the workspace where all intermediate and output files will be written. If the selected folder does not exist, it will be created. If datasets already exist in the selected folder, they will be overwritten. (required) dem_uri (string) – A GDAL-supported raster file containing a base Digital Elevation Model to execute the routing functionality across. (required) pit_filled_filename (string) – The filename of the output raster with pits filled in. It will go in the project workspace. (required) flow_direction_filename (string) – The filename of the flow direction raster. It will go in the project workspace. (required) flow_accumulation_filename (string) – The filename of the flow accumulation raster. It will go in the project workspace. (required) threshold_flow_accumulation (int) – The number of upstream cells that must flow into a cell before it’s classified as a stream. (required) multiple_stream_thresholds (bool) – Set to True to calculate multiple maps. If enabled, set stream threshold to the lowest amount, then set upper and step size thresholds. (optional) threshold_flow_accumulation_upper (int) – The number of upstream pixels that must flow into a cell before it’s classified as a stream. (required) threshold_flow_accumulation_stepsize (int) – The number of cells to step up from lower to upper threshold range. (required) calculate_slope (bool) – Set to True to output a slope raster. (optional) slope_filename (string) – The filename of the output slope raster. This will go in the project workspace. (required) calculate_downstream_distance (bool) – Select to calculate a distance stream raster, based on uppper threshold limit. (optional) downstream_distance_filename (string) – The filename of the output raster. It will go in the project workspace. (required) None