reV.supply_curve.exclusions.LayerMask

class LayerMask(layer, exclude_values=None, exclude_range=(None, None), include_values=None, include_range=(None, None), include_weights=None, force_include_values=None, force_include_range=None, use_as_weights=False, weight=1.0, exclude_nodata=False, nodata_value=None, **kwargs)[source]

Bases: object

Class to convert exclusion layer to inclusion layer mask

Parameters:
  • layer (str) – Layer name.

  • exclude_values (int | float | list, optional) – Single value or list of values to exclude.

    Important

    The keyword arguments exclude_values, exclude_range, include_values, include_range, include_weights, force_include_values, and force_include_range are all mutually exclusive. Users should supply value(s) for exactly one of these arguments.

    By default, None.

  • exclude_range (list | tuple, optional) – Two-item list of (min threshold, max threshold) for values to exclude. Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • include_values (int | float | list, optional) – Single value or list of values to include. Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • include_range (list | tuple, optional) – Two-item list of (min threshold, max threshold) for values to include. Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • include_weights (dict, optional) – A dictionary of {value: weight} pairs, where the value in the layer that should be included with the given weight. Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • force_include_values (int | float | list, optional) – Force the inclusion of the given value(s). Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • force_include_range (list | tuple, optional) – Force the inclusion of given values in the range (min threshold, max threshold). Mutually exclusive with other inputs - see info in the description of exclude_values. By default, None.

  • use_as_weights (bool, optional) – Option to use layer as final inclusion weights. If True, all inclusion/exclusions specifications for the layer are ignored and the raw values (scaled by the weight input) are used as weights. By default, False.

  • weight (float, optional) – Weight applied to exclusion layer after it is calculated. Can be used, for example, to turn a binary exclusion layer (i.e. data with 0 or 1 values and exclude_values=1 input) into partial exclusions by setting the weight to a fraction (e.g. 0.5 for 50% exclusions). By default, 1.

  • exclude_nodata (bool, optional) – Flag to exclude nodata values (nodata_value). If nodata_value=None the nodata_value is inferred by reV.supply_curve.exclusions.ExclusionMask. By default, False.

  • nodata_value (int | float, optional) – Nodata value for the layer. If None, the value will be inferred when LayerMask is added to reV.supply_curve.exclusions.ExclusionMask. By default, None.

  • **kwargs – Optional inputs to maintain legacy kwargs of inclusion_* instead of include_*.

Methods

Attributes

exclude_values

Values to exclude

force_include

Flag to force include mask

include_values

Values to include

include_weights

Mapping of values to include and at what weights

mask_type

Type of exclusion mask for this layer

max_value

Maximum value to include/exclude if include_range or exclude_range was input.

min_value

Minimum value to include/exclude if include_range or exclude_range was input.

name

Layer name to extract from exclusions .h5 file

property name

Layer name to extract from exclusions .h5 file

Returns:

_name (str)

property min_value

Minimum value to include/exclude if include_range or exclude_range was input.

Returns:

float

property max_value

Maximum value to include/exclude if include_range or exclude_range was input.

Returns:

float

property exclude_values

Values to exclude

Returns:

_exclude_values (list)

property include_values

Values to include

Returns:

_include_values (list)

property include_weights

Mapping of values to include and at what weights

Returns:

dict

property force_include

Flag to force include mask

Returns:

_force_include (bool)

property mask_type

Type of exclusion mask for this layer

Returns:

str