Hydropower Package

Model Entry Point

invest_natcap.hydropower.hydropower_water_yield.execute(args)

Executes the hydropower/water_yield model

args - a python dictionary with at least the following possible entries:

args[‘workspace_dir’] - a uri to the directory that will write output
and other temporary files during calculation. (required)
args[‘lulc_uri’] - a uri to a land use/land cover raster whose
LULC indexes correspond to indexes in the biophysical table input. Used for determining soil retention and other biophysical properties of the landscape. (required)
args[‘depth_to_root_rest_layer_uri’] - a uri to an input raster describing the
depth of “good” soil before reaching this restrictive layer (required)
args[‘precipitation_uri’] - a uri to an input raster describing the
average annual precipitation value for each cell (mm) (required)
args[‘pawc_uri’] - a uri to an input raster describing the
plant available water content value for each cell. Plant Available Water Content fraction (PAWC) is the fraction of water that can be stored in the soil profile that is available for plants’ use. PAWC is a fraction from 0 to 1 (required)
args[‘eto_uri’] - a uri to an input raster describing the
annual average evapotranspiration value for each cell. Potential evapotranspiration is the potential loss of water from soil by both evaporation from the soil and transpiration by healthy Alfalfa (or grass) if sufficient water is available (mm) (required)
args[‘watersheds_uri’] - a uri to an input shapefile of the watersheds
of interest as polygons. (required)
args[‘sub_watersheds_uri’] - a uri to an input shapefile of the
subwatersheds of interest that are contained in the ‘watersheds_uri’ shape provided as input. (optional)
args[‘biophysical_table_uri’] - a uri to an input CSV table of
land use/land cover classes, containing data on biophysical coefficients such as root_depth (mm) and Kc, which are required. A column with header LULC_veg is also required which should have values of 1 or 0, 1 indicating a land cover type of vegetation, a 0 indicating non vegetation or wetland, water. NOTE: these data are attributes of each LULC class rather than attributes of individual cells in the raster map (required)
args[‘seasonality_constant’] - floating point value between 1 and 10
corresponding to the seasonal distribution of precipitation (required)
args[‘results_suffix’] - a string that will be concatenated onto the
end of file names (optional)
args[‘demand_table_uri’] - a uri to an input CSV table of LULC classes,
showing consumptive water use for each landuse / land-cover type (cubic meters per year) (required for water scarcity)
args[‘valuation_table_uri’] - a uri to an input CSV table of
hydropower stations with the following fields (required for valuation): (‘ws_id’, ‘time_span’, ‘discount’, ‘efficiency’, ‘fraction’, ‘cost’, ‘height’, ‘kw_price’)

returns - nothing

Hydropower Water Yield

Module that contains the core computational components for the hydropower model including the water yield, water scarcity, and valuation functions

invest_natcap.hydropower.hydropower_water_yield.add_dict_to_shape(shape_uri, field_dict, field_name, key)

Add a new field to a shapefile with values from a dictionary. The dictionaries keys should match to the values of a unique fields values in the shapefile

shape_uri - a URI path to a ogr datasource on disk with a unique field
‘key’. The field ‘key’ should have values that correspond to the keys of ‘field_dict’
field_dict - a python dictionary with keys mapping to values. These
values will be what is filled in for the new field

field_name - a string for the name of the new field to add

key - a string for the field name in ‘shape_uri’ that represents
the unique features

returns - nothing

invest_natcap.hydropower.hydropower_water_yield.compute_rsupply_volume(watershed_results_uri)

Calculate the total realized water supply volume and the mean realized water supply volume per hectare for the given sheds. Output units in cubic meters and cubic meters per hectare respectively.

watershed_results_uri - a URI path to an OGR shapefile to get water yield
values from

returns - Nothing

invest_natcap.hydropower.hydropower_water_yield.compute_water_yield_volume(shape_uri, pixel_area)

Calculate the water yield volume per sub-watershed or watershed. Add results to shape_uri, units are cubic meters

shape_uri - a URI path to an ogr datasource for the sub-watershed
or watershed shapefile. This shapefiles features should have a ‘wyield_mn’ attribute, which calculations are derived from
pixel_area - the area in meters squared of a pixel from the wyield
raster.

returns - Nothing

invest_natcap.hydropower.hydropower_water_yield.compute_watershed_valuation(watersheds_uri, val_dict)

Computes and adds the net present value and energy for the watersheds to an output shapefile.

watersheds_uri - a URI path to an OGR shapefile for the
watershed results. Where the results will be added.
val_dict - a python dictionary that has all the valuation parameters for
each watershed

returns - Nothing

invest_natcap.hydropower.hydropower_water_yield.execute(args)

Executes the hydropower/water_yield model

args - a python dictionary with at least the following possible entries:

args[‘workspace_dir’] - a uri to the directory that will write output
and other temporary files during calculation. (required)
args[‘lulc_uri’] - a uri to a land use/land cover raster whose
LULC indexes correspond to indexes in the biophysical table input. Used for determining soil retention and other biophysical properties of the landscape. (required)
args[‘depth_to_root_rest_layer_uri’] - a uri to an input raster describing the
depth of “good” soil before reaching this restrictive layer (required)
args[‘precipitation_uri’] - a uri to an input raster describing the
average annual precipitation value for each cell (mm) (required)
args[‘pawc_uri’] - a uri to an input raster describing the
plant available water content value for each cell. Plant Available Water Content fraction (PAWC) is the fraction of water that can be stored in the soil profile that is available for plants’ use. PAWC is a fraction from 0 to 1 (required)
args[‘eto_uri’] - a uri to an input raster describing the
annual average evapotranspiration value for each cell. Potential evapotranspiration is the potential loss of water from soil by both evaporation from the soil and transpiration by healthy Alfalfa (or grass) if sufficient water is available (mm) (required)
args[‘watersheds_uri’] - a uri to an input shapefile of the watersheds
of interest as polygons. (required)
args[‘sub_watersheds_uri’] - a uri to an input shapefile of the
subwatersheds of interest that are contained in the ‘watersheds_uri’ shape provided as input. (optional)
args[‘biophysical_table_uri’] - a uri to an input CSV table of
land use/land cover classes, containing data on biophysical coefficients such as root_depth (mm) and Kc, which are required. A column with header LULC_veg is also required which should have values of 1 or 0, 1 indicating a land cover type of vegetation, a 0 indicating non vegetation or wetland, water. NOTE: these data are attributes of each LULC class rather than attributes of individual cells in the raster map (required)
args[‘seasonality_constant’] - floating point value between 1 and 10
corresponding to the seasonal distribution of precipitation (required)
args[‘results_suffix’] - a string that will be concatenated onto the
end of file names (optional)
args[‘demand_table_uri’] - a uri to an input CSV table of LULC classes,
showing consumptive water use for each landuse / land-cover type (cubic meters per year) (required for water scarcity)
args[‘valuation_table_uri’] - a uri to an input CSV table of
hydropower stations with the following fields (required for valuation): (‘ws_id’, ‘time_span’, ‘discount’, ‘efficiency’, ‘fraction’, ‘cost’, ‘height’, ‘kw_price’)

returns - nothing

invest_natcap.hydropower.hydropower_water_yield.extract_datasource_table_by_key(datasource_uri, key_field, wanted_list)

Create a dictionary lookup table of the features in the attribute table of the datasource referenced by datasource_uri.

datasource_uri - a uri to an OGR datasource key_field - a field in datasource_uri that refers to a key (unique) value

for each row; for example, a polygon id.
wanted_list - a list of field names to add to the dictionary. This is
helpful if there are fields that are not wanted to be returned
returns a dictionary of the form {key_field_0:
{field_0: value0, field_1: value1}...}
invest_natcap.hydropower.hydropower_water_yield.write_new_table(filename, fields, data)

Create a new csv table from a dictionary

filename - a URI path for the new table to be written to disk

fields - a python list of the column names. The order of the fields in
the list will be the order in how they are written. ex: [‘id’, ‘precip’, ‘total’]
data - a python dictionary representing the table. The dictionary

should be constructed with unique numerical keys that point to a dictionary which represents a row in the table: data = {0 : {‘id’:1, ‘precip’:43, ‘total’: 65},

1 : {‘id’:2, ‘precip’:65, ‘total’: 94}}

returns - nothing

Module contents