reV.supply_curve.exclusions.ExclusionMask
- class ExclusionMask(excl_h5, layers=None, min_area=None, kernel='queen', hsds=False, check_layers=False)[source]
Bases:
object
Class to create final exclusion mask
- Parameters:
excl_h5 (str | list | tuple) – Path to one or more exclusions .h5 files
layers (list | NoneType) – list of LayerMask instances for each exclusion layer to combine
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
run
(excl_h5[, layers, min_area, kernel, hsds])Create inclusion mask from given layers
Attributes
FILTER_KERNELS
Open ExclusionLayers instance
List of available exclusion layers in exclusions .h5
Latitude coordinates array
List of layers to combines
List of LayerMask instances for each exclusion layer to combine
Longitude coordinates array
Inclusion mask for entire exclusion domain
Get a dictionary lookup of the nodata values for each layer name.
Get the exclusions shape.
- property shape
Get the exclusions shape.
- Returns:
shape (tuple) – (rows, cols) shape tuple
- 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 layer_names
List of layers to combines
- Returns:
list
- property layers
List of LayerMask instances for each exclusion layer to combine
- Returns:
list
- property mask
Inclusion mask for entire exclusion domain
- Returns:
ndarray
- property latitude
Latitude coordinates array
- Returns:
ndarray
- property longitude
Longitude coordinates array
- Returns:
ndarray
- add_layer(layer, replace=False)[source]
Add layer to be combined
- Parameters:
layer (LayerMask) – LayerMask instance to add to set of layers to be combined
- 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.
- classmethod run(excl_h5, layers=None, min_area=None, kernel='queen', hsds=False)[source]
Create inclusion mask from given layers
- Parameters:
excl_h5 (str | list | tuple) – Path to one or more exclusions .h5 files
layers (list | NoneType) – list of LayerMask instances for each exclusion layer to combine
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