natcap.invest.hydropower package

Submodules

natcap.invest.hydropower.hydropower_water_yield module

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

natcap.invest.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

natcap.invest.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

natcap.invest.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

natcap.invest.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

natcap.invest.hydropower.hydropower_water_yield.execute(args)

Annual Water Yield: Reservoir Hydropower Production.

Executes the hydropower/water_yield model

Parameters:
  • args['workspace_dir'] (string) – a uri to the directory that will write output and other temporary files during calculation. (required)
  • args['lulc_uri'] (string) – 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'] (string) – a uri to an input raster describing the depth of “good” soil before reaching this restrictive layer (required)
  • args['precipitation_uri'] (string) – a uri to an input raster describing the average annual precipitation value for each cell (mm) (required)
  • args['pawc_uri'] (string) – 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'] (string) – 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'] (string) – a uri to an input shapefile of the watersheds of interest as polygons. (required)
  • args['sub_watersheds_uri'] (string) – a uri to an input shapefile of the subwatersheds of interest that are contained in the args['watersheds_uri'] shape provided as input. (optional)
  • args['biophysical_table_uri'] (string) – 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'] (float) – floating point value between 1 and 10 corresponding to the seasonal distribution of precipitation (required)
  • args['results_suffix'] (string) – a string that will be concatenated onto the end of file names (optional)
  • args['demand_table_uri'] (string) – 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'] (string) – 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:

None

natcap.invest.hydropower.hydropower_water_yield.filter_dictionary(dict_data, values)

Create a subset of a dictionary given keys found in a list.

The incoming dictionary should have keys that point to dictionary’s.
Create a subset of that dictionary by using the same outer keys but only using the inner key:val pair if that inner key is found in the values list.
Parameters:
  • dict_data (dictionary) – a dictionary that has keys which point to dictionary’s.
  • values (list) – a list of keys to keep from the inner dictionary’s of ‘dict_data’
Returns:

a dictionary

natcap.invest.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