revrt.costs.dry_costs_creator.DryCostsCreator#

class DryCostsCreator(io_handler, input_layer_dir='.', output_tiff_dir='.', dtype='float32')[source]#

Bases: BaseLayerCreator

Class to create and save dry transmission cost layers

Parameters:
  • io_handler (LayeredFile) – Transmission layer IO handler

  • input_layer_dir (path-like, optional) – Directory to search for input layers in, if not found in current directory. By default, '.'.

  • output_tiff_dir (path-like, optional) – Directory where cost layers should be saved as GeoTIFF. By default, ".".

  • dtype (np.dtype, optional) – Data type for final dataset. By default, float32.

Methods

build(iso_region_tiff, nlcd_tiff, slope_tiff)

Build cost rasters using base line costs and multipliers

Attributes

cell_size

Size of cell in layer file

chunks

Layer chunks (no band dimension)

output_tiff_dir

Directory to store output GeoTIFFs in

shape

Layer shape

build(iso_region_tiff, nlcd_tiff, slope_tiff, transmission_config=None, mask=None, default_multipliers=None, extra_tiffs=None, tiff_chunks='file', descriptions=None, nodata=None, lock=None, **profile_kwargs)[source]#

Build cost rasters using base line costs and multipliers

This function also allows you to save to GeoTIFF.

Cells without a know ISO region are left with a cost value of 0.

Parameters:
  • iso_region_tiff (path-like) – Path to the ISO region GeoTIFF.

  • nlcd_tiff (path-like) – Path to the National Land Coverage Database GeoTIFF.

  • slope_tiff (path-like) – Path to the slope GeoTIFF. Slope must be in decimal percent.

  • transmission_config (dict | path-like, optional) – Dictionary or path to JSON file containing dictionary with transmission cost configuration values. Valid configuration keys are:

    • “base_line_costs”

    • “iso_lookup”

    • “iso_multipliers”

    • “land_use_classes”

    • “new_substation_costs”

    • “power_classes”

    • “power_to_voltage”

    • “transformer_costs”

    • “upgrade_substation_costs”

    Each of these keys should point to a dictionary or a path to a separate path-like file containing a dictionary of configurations for each section. BY default, None, which uses the default cost configs for all values.

  • mask (ndarray) – Boolean array representing mask where dry cost values should be applied. BY default, None, which does not apply a mask to the cost array.

  • default_multipliers (dict | IsoMultipliers, optional) – Multipliers for regions not specified in the iso_region_tiff. Must be a dictionary of the form:

    "land_use": {
        "cropland": 1.03,
        "forest": 1.2,
        "suburban": 1.08,
        "urban": 1.2,
        "wetland": 1.8
    },
    "slope": {
        "hill_mult": 1.1,
        "hill_slope": 2,
        "mtn_mult": 1.21,
        "mtn_slope": 8
    }
    

    All keys are optional. By default, None.

  • extra_tiffs (list, optional) – Optional list of extra GeoTIFFs to add to cost layer file (e.g. a transmission barrier file). By default, None, which does not add any extra layers.

  • descriptions (dict, optional) – Optional mapping where keys are layer names and values are descriptions to add to the layer’s attributes meta dictionary under the “description” key. By default, None, which does not add any description.

  • nodata (dict, optional) – Optional mapping where keys are layer names and values are the nodata value for the output raster of that layer. This value will be added to the layer’s attributes meta dictionary under the “nodata” key. By default, None.

  • lock (bool | `dask.distributed.Lock`, optional) – Lock to use to write data to GeoTIFF using dask. If not supplied, a single process is used for writing data to disk. By default, None.

  • **profile_kwargs – Additional keyword arguments to pass into writing output rasters. The following attributes ar ignored (they are set using properties of the LayeredFile):

    • nodata

    • transform

    • crs

    • count

    • width

    • height

property cell_size#

Size of cell in layer file

Type:

float

property chunks#

Layer chunks (no band dimension)

Type:

tuple

property output_tiff_dir#

Directory to store output GeoTIFFs in

Type:

path-like

property shape#

Layer shape

Type:

tuple