# natcap.invest.routing package¶

## natcap.invest.routing.delineateit module¶

DelineateIt wrapper for natcap.invest.pygeoprocessing_0_3_3’s watershed delineation routine.

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

Delineateit: Watershed Delineation.

This ‘model’ provides an InVEST-based wrapper around the natcap.invest.pygeoprocessing_0_3_3 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) 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 for exposing the natcap.invest’s routing package to UI.

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

RouteDEM: D-Infinity Routing.

This model exposes the pygeoprocessing_0_3_3 d-infinity routing functionality as an InVEST model.

Parameters: args['workspace_dir'] (string) – output directory for intermediate, temporary, and final files args['results_suffix'] (string) – (optional) string to append to any output file names args['dem_path'] (string) – path to a digital elevation raster args['calculate_flow_accumulation'] (bool) – If True, model will calculate a flow accumulation raster. args['calculate_stream_threshold'] (bool) – if True, model will calculate a stream classification layer by thresholding flow accumulation to the provided value in args[‘threshold_flow_accumulation’]. args['threshold_flow_accumulation'] (int) – The number of upstream cells that must flow into a cell before it’s classified as a stream. args['calculate_downstream_distance'] (bool) – If True, and a stream threshold is calculated, model will calculate a downstream distance raster in units of pixels. args['calculate_slope'] (bool) – If True, model will calculate a slope raster. None