# Nutrient Delivery Ratio Package¶

## Model Entry Point¶

invest_natcap.ndr.ndr.execute(args)

Nutrient delivery ratio model:

args - a python dictionary with the following entries:

‘workspace_dir’ - a string uri pointing to the current workspace. ‘dem_uri’ - a string uri pointing to the Digital Elevation Map

(DEM), a GDAL raster on disk.
‘pixel_yield_uri’ - a string uri pointing to the water yield raster
output from the InVEST Water Yield model.

‘lulc_uri’ - a string uri pointing to the landcover GDAL raster. ‘watersheds_uri’ - a string uri pointing to an OGR shapefile on

disk representing the user’s watersheds.
‘biophysical_table_uri’ - a string uri to a supported table on disk
containing nutrient retention values. (SAY WHAT VALUES ARE)
‘calc_p’ - True if phosphorous is meant to be modeled, if True then
biophyscial table must have p fields in them.
‘calc_n’ - True if nitrogen is meant to be modeled, if True then
biophyscial table must have n fields in them.

‘results_suffix’ - (optional) a text field to append to all output files. ‘threshold_flow_accumulation’ - a number representing the flow accumulation. ‘_prepare’ - (optional) The preprocessed set of data created by the

ndr._prepare call. This argument could be used in cases where the call to this function is scripted and can save a significant amount of runtime.

returns nothing.

## Nutrient Delivery Ratio¶

Module for the execution of the biophysical component of the InVEST Nutrient Deposition model.

invest_natcap.ndr.ndr.add_fields_to_shapefile(key_field, field_summaries, output_layer, field_header_order=None)

Adds fields and their values indexed by key fields to an OGR layer open for writing.

key_field - name of the key field in the output_layer that
uniquely identifies each polygon.
field_summaries - a dictionary indexed by the desired field
name to place in the polygon that indexes to another dictionary indexed by key_field value to map to that particular polygon. ex {‘field_name_1’: {key_val1: value, key_val2: value}, ‘field_name_2’: {key_val1: value, etc.

output_layer - an open writable OGR layer field_header_order - a list of field headers in the order we

wish them to appear in the output table, if None then random key order in field summaries is used.

returns nothing

invest_natcap.ndr.ndr.execute(args)

Nutrient delivery ratio model:

args - a python dictionary with the following entries:

‘workspace_dir’ - a string uri pointing to the current workspace. ‘dem_uri’ - a string uri pointing to the Digital Elevation Map

(DEM), a GDAL raster on disk.
‘pixel_yield_uri’ - a string uri pointing to the water yield raster
output from the InVEST Water Yield model.

‘lulc_uri’ - a string uri pointing to the landcover GDAL raster. ‘watersheds_uri’ - a string uri pointing to an OGR shapefile on

disk representing the user’s watersheds.
‘biophysical_table_uri’ - a string uri to a supported table on disk
containing nutrient retention values. (SAY WHAT VALUES ARE)
‘calc_p’ - True if phosphorous is meant to be modeled, if True then
biophyscial table must have p fields in them.
‘calc_n’ - True if nitrogen is meant to be modeled, if True then
biophyscial table must have n fields in them.

‘results_suffix’ - (optional) a text field to append to all output files. ‘threshold_flow_accumulation’ - a number representing the flow accumulation. ‘_prepare’ - (optional) The preprocessed set of data created by the

ndr._prepare call. This argument could be used in cases where the call to this function is scripted and can save a significant amount of runtime.

returns nothing.