Scenario Generator Package

Scenario Generator

invest_natcap.scenario_generator.scenario_generator.calculate_distance_raster_uri(dataset_in_uri, dataset_out_uri)
invest_natcap.scenario_generator.scenario_generator.calculate_weights(arr, rounding=4)
invest_natcap.scenario_generator.scenario_generator.filter_fragments(input_uri, size, output_uri)
invest_natcap.scenario_generator.scenario_generator.generate_chart_html(cover_dict, cover_names_dict, workspace_dir)
invest_natcap.scenario_generator.scenario_generator.sum_uri(dataset_uri, datasource_uri)

Wrapper call to pygeoprocessing.geoprocessing.aggregate_raster_values_uri to extract total

Parameters:dataset_uri (str) – The uri for the input raster.
Return type:None

Scenario Generator Summary



invest_natcap.scenario_generator.despeckle.filter_fragments(src_array, value, patch_size, pixel_count, replace=None)
invest_natcap.scenario_generator.despeckle.filter_fragments_uri(input_uri, value, patch_size, pixel_count, output_uri, replace=None)
invest_natcap.scenario_generator.despeckle.new_raster_from_base(base, output_uri, gdal_format, nodata, datatype, fill_value=None)

Create a new, empty GDAL raster dataset with the spatial references, dimensions and geotranforms of the base GDAL raster dataset.

base - a the GDAL raster dataset to base output size, and transforms on output_uri - a string URI to the new output raster dataset. gdal_format - a string representing the GDAL file format of the

output raster. See for a list of available formats. This parameter expects the format code, such as ‘GTiff’ or ‘MEM’
nodata - a value that will be set as the nodata value for the
output raster. Should be the same type as ‘datatype’
datatype - the pixel datatype of the output raster, for example
gdal.GDT_Float32. See the following header file for supported pixel types:

fill_value - (optional) the value to fill in the raster on creation

returns a new GDAL raster dataset.

invest_natcap.scenario_generator.despeckle.new_raster_from_base_uri(base_uri, *args, **kwargs)

A wrapper for the function new_raster_from_base that opens up the base_uri before passing it to new_raster_from_base.

base_uri - a URI to a GDAL dataset on disk.

All other arguments to new_raster_from_base are passed in.

Returns nothing.


Returns a temporary filename using mkstemp. The file is deleted on exit using the atexit register.

returns a unique temporary filename

Disk Sort

invest_natcap.scenario_generator.disk_sort.sort_to_disk(dataset_uri, dataset_index)

Sorts the non-nodata pixels in the dataset on disk and returns an iterable in sorted order.

dataset_uri - a uri to a GDAL dataset dataset_index - an integer to keep track of which dataset

we’re encoding. This will help us later if we merge several of these iterators together
returns an iterable that returns (-value, flat_index, dataset_index)
in decreasing sorted order by -value

Module contents