reV.supply_curve.exclusions.ExclusionMaskFromDict

class ExclusionMaskFromDict(excl_h5, layers_dict=None, min_area=None, kernel='queen', hsds=False, check_layers=False)[source]

Bases: ExclusionMask

Class to initialize ExclusionMask from a dictionary defining layers

Parameters:
  • excl_h5 (str | list | tuple) – Path to one or more exclusions .h5 files

  • layers_dict (dict | NoneType) – Dictionary of LayerMask arugments {layer: {kwarg: value}}

  • min_area (float | NoneType) – Minimum required contiguous area in sq-km

  • kernel (str) – Contiguous filter method to use on final exclusion

  • hsds (bool) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS

  • check_layers (bool) – Run a pre-flight check on each layer to ensure they contain un-excluded values

Methods

add_layer(layer[, replace])

Add layer to be combined

close()

Close h5 instance

extract_inclusion_mask(excl_fpath, tm_dset)

Extract the full inclusion mask from excl_fpath using the given exclusion layers and whether or not to run a minimum area filter

run(excl_h5[, layers_dict, min_area, ...])

Create inclusion mask from given layers dictionary

Attributes

FILTER_KERNELS

excl_h5

Open ExclusionLayers instance

excl_layers

List of available exclusion layers in exclusions .h5

latitude

Latitude coordinates array

layer_names

List of layers to combines

layers

List of LayerMask instances for each exclusion layer to combine

longitude

Longitude coordinates array

mask

Inclusion mask for entire exclusion domain

nodata_lookup

Get a dictionary lookup of the nodata values for each layer name.

shape

Get the exclusions shape.

classmethod extract_inclusion_mask(excl_fpath, tm_dset, excl_dict=None, area_filter_kernel='queen', min_area=None)[source]

Extract the full inclusion mask from excl_fpath using the given exclusion layers and whether or not to run a minimum area filter

Parameters:
  • excl_fpath (str | list | tuple) – Filepath to exclusions h5 with techmap dataset (can be one or more filepaths).

  • tm_dset (str) – Dataset name in the techmap file containing the exclusions-to-resource mapping data.

  • excl_dict (dict | None) – Dictionary of exclusion keyword arugments of the format {layer_dset_name: {kwarg: value}} where layer_dset_name is a dataset in the exclusion h5 file and kwarg is a keyword argument to the reV.supply_curve.exclusions.LayerMask class.

  • area_filter_kernel (str, optional) – Contiguous area filter method to use on final exclusions mask, by default “queen”

  • min_area (float, optional) – Minimum required contiguous area filter in sq-km, by default None

Returns:

inclusion_mask (ndarray) – Pre-computed 2D inclusion mask (normalized with expected range: [0, 1], where 1 is included and 0 is excluded)

classmethod run(excl_h5, layers_dict=None, min_area=None, kernel='queen', hsds=False)[source]

Create inclusion mask from given layers dictionary

Parameters:
  • excl_h5 (str | list | tuple) – Path to one or more exclusions .h5 files

  • layers_dict (dict | NoneType) – Dictionary of LayerMask arugments {layer: {kwarg: value}}

  • min_area (float | NoneType) – Minimum required contiguous area in sq-km

  • kernel (str) – Contiguous filter method to use on final exclusion

  • hsds (bool) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS

Returns:

mask (ndarray) – Full inclusion mask

add_layer(layer, replace=False)

Add layer to be combined

Parameters:

layer (LayerMask) – LayerMask instance to add to set of layers to be combined

close()

Close h5 instance

property excl_h5

Open ExclusionLayers instance

Returns:

_excl_h5 (ExclusionLayers)

property excl_layers

List of available exclusion layers in exclusions .h5

Returns:

_excl_layers (list)

property latitude

Latitude coordinates array

Returns:

ndarray

property layer_names

List of layers to combines

Returns:

list

property layers

List of LayerMask instances for each exclusion layer to combine

Returns:

list

property longitude

Longitude coordinates array

Returns:

ndarray

property mask

Inclusion mask for entire exclusion domain

Returns:

ndarray

property nodata_lookup

Get a dictionary lookup of the nodata values for each layer name.

Returns:

nodata (dict) – Lookup keyed by layer name and values are nodata values for the respective layers.

property shape

Get the exclusions shape.

Returns:

shape (tuple) – (rows, cols) shape tuple