reV.supply_curve.points.SupplyCurvePoint

class SupplyCurvePoint(gid, excl, tm_dset, excl_dict=None, inclusion_mask=None, resolution=64, excl_area=None, exclusion_shape=None, close=True)[source]

Bases: AbstractSupplyCurvePoint

Generic single SC point based on exclusions, resolution, and techmap

Parameters:
  • gid (int) – gid for supply curve point to analyze.

  • excl (str | list | tuple | ExclusionMask) – Filepath(s) to exclusions h5 or ExclusionMask file handler.

  • tm_dset (str) – Dataset name in the exclusions 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. None if excl input is pre-initialized.

  • inclusion_mask (np.ndarray) – 2D array pre-extracted inclusion mask where 1 is included and 0 is excluded. The shape of this will be checked against the input resolution.

  • resolution (int) – Number of exclusion points per SC point along an axis. This number**2 is the total number of exclusion points per SC point.

  • excl_area (float | None, optional) – Area of an exclusion pixel in km2. None will try to infer the area from the profile transform attribute in excl_fpath, by default None

  • exclusion_shape (tuple) – Shape of the full exclusions extent (rows, cols). Inputing this will speed things up considerably.

  • close (bool) – Flag to close object file handlers on exit.

Methods

agg_data_layers(summary, data_layers)

Perform additional data layer aggregation.

aggregate(arr)

Calc sum (aggregation) of the resource data.

close()

Close all file handlers.

exclusion_weighted_mean(arr[, drop_nan])

Calc the exclusions-weighted mean value of an array of resource data.

get_agg_slices(gid, shape, resolution)

Get the row, col slices of an aggregation gid.

mean_wind_dirs(arr)

Calc the mean wind directions at every time-step

sc_mean(gid, excl, tm_dset, data[, ...])

Compute exclusions weight mean for the sc point from data

sc_sum(gid, excl, tm_dset, data[, ...])

Compute the aggregate (sum) of data for the sc point

Attributes

area

Get the non-excluded resource area of the supply curve point in the current resource class.

bool_mask

Get a boolean inclusion mask (True if excl point is not excluded).

centroid

Get the supply curve point centroid coordinate.

cols

Get the cols of the exclusions layer associated with this SC point.

exclusions

Get the exclusions object.

gid

Supply curve point gid

h5

placeholder for h5 Resource handler object

h5_gid_set

Get list of unique h5 gids corresponding to this sc point.

include_mask

[0, 1] where 1 is included and 0 is excluded).

include_mask_flat

Get the flattened inclusion mask (normalized with expected range: [0, 1] where 1 is included and 0 is excluded).

latitude

Get the SC point latitude

longitude

Get the SC point longitude

n_gids

Get the total number of not fully excluded pixels associated with the available resource/generation gids at the given sc gid.

pixel_area

The area in km2 of a single exclusion pixel.

resolution

Get the supply curve grid aggregation resolution

rows

Get the rows of the exclusions layer associated with this SC point.

sc_col_ind

Supply curve column index

sc_point_gid

Supply curve point gid

sc_row_ind

Supply curve row index

summary

Placeholder for Supply curve point's meta data summary

close()[source]

Close all file handlers.

property exclusions

Get the exclusions object.

Returns:

_excls (ExclusionMask) – ExclusionMask h5 handler object.

property centroid

Get the supply curve point centroid coordinate.

Returns:

centroid (tuple) – SC point centroid (lat, lon).

property pixel_area

The area in km2 of a single exclusion pixel. If this value was not provided on initialization, it is determined from the profile of the exclusion file.

Returns:

float

property area

Get the non-excluded resource area of the supply curve point in the current resource class.

Returns:

area (float) – Non-excluded resource/generation area in square km.

property latitude

Get the SC point latitude

property longitude

Get the SC point longitude

property n_gids

Get the total number of not fully excluded pixels associated with the available resource/generation gids at the given sc gid.

Returns:

n_gids (list)

property include_mask

[0, 1] where 1 is included and 0 is excluded).

Returns:

np.ndarray

Type:

Get the 2D inclusion mask (normalized with expected range

property include_mask_flat

Get the flattened inclusion mask (normalized with expected range: [0, 1] where 1 is included and 0 is excluded).

Returns:

np.ndarray

property bool_mask

Get a boolean inclusion mask (True if excl point is not excluded).

Returns:

mask (np.ndarray) – Mask with length equal to the flattened exclusion shape

property h5

placeholder for h5 Resource handler object

property h5_gid_set

Get list of unique h5 gids corresponding to this sc point.

Returns:

h5_gids (list) – List of h5 gids.

property summary

Placeholder for Supply curve point’s meta data summary

exclusion_weighted_mean(arr, drop_nan=True)[source]

Calc the exclusions-weighted mean value of an array of resource data.

Parameters:
  • arr (np.ndarray) – Array of resource data.

  • drop_nan (bool) – Flag to drop nan values from the mean calculation (only works for 1D arr input, profiles should not have NaN’s)

Returns:

mean (float | np.ndarray) – Mean of arr masked by the binary exclusions then weighted by the non-zero exclusions. This will be a 1D numpy array if the input data is a 2D numpy array (averaged along axis=1)

mean_wind_dirs(arr)[source]

Calc the mean wind directions at every time-step

Parameters:

arr (np.ndarray) – Array of wind direction data.

Returns:

mean_wind_dirs (np.ndarray | float) – Mean wind direction of arr masked by the binary exclusions

aggregate(arr)[source]

Calc sum (aggregation) of the resource data.

Parameters:

arr (np.ndarray) – Array of resource data.

Returns:

agg (float) – Sum of arr masked by the binary exclusions

classmethod sc_mean(gid, excl, tm_dset, data, excl_dict=None, resolution=64, exclusion_shape=None, close=True)[source]

Compute exclusions weight mean for the sc point from data

Parameters:
  • gid (int) – gid for supply curve point to analyze.

  • excl (str | ExclusionMask) – Filepath to exclusions h5 or ExclusionMask file handler.

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

  • data (ndarray | ResourceDataset) – Array of data or open dataset handler to apply exclusions too

  • 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. None if excl input is pre-initialized.

  • resolution (int) – Number of exclusion points per SC point along an axis. This number**2 is the total number of exclusion points per SC point.

  • exclusion_shape (tuple) – Shape of the full exclusions extent (rows, cols). Inputing this will speed things up considerably.

  • close (bool) – Flag to close object file handlers on exit

Returns:

ndarray – Exclusions weighted means of data for supply curve point

classmethod sc_sum(gid, excl, tm_dset, data, excl_dict=None, resolution=64, exclusion_shape=None, close=True)[source]

Compute the aggregate (sum) of data for the sc point

Parameters:
  • gid (int) – gid for supply curve point to analyze.

  • excl (str | ExclusionMask) – Filepath to exclusions h5 or ExclusionMask file handler.

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

  • data (ndarray | ResourceDataset) – Array of data or open dataset handler to apply exclusions too

  • 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. None if excl input is pre-initialized.

  • resolution (int) – Number of exclusion points per SC point along an axis. This number**2 is the total number of exclusion points per SC point.

  • exclusion_shape (tuple) – Shape of the full exclusions extent (rows, cols). Inputing this will speed things up considerably.

  • close (bool) – Flag to close object file handlers on exit.

Returns:

ndarray – Sum / aggregation of data for supply curve point

agg_data_layers(summary, data_layers)[source]

Perform additional data layer aggregation. If there is no valid data in the included area, the data layer will be taken from the full SC point extent (ignoring exclusions). If there is still no valid data, a warning will be raised and the data layer will have a NaN/None value.

Parameters:
  • summary (dict) – Dictionary of summary outputs for this sc point.

  • data_layers (None | dict) – Aggregation data layers. Must be a dictionary keyed by data label name. Each value must be another dictionary with “dset”, “method”, and “fpath”.

Returns:

summary (dict) – Dictionary of summary outputs for this sc point. A new entry for each data layer is added.

property cols

Get the cols of the exclusions layer associated with this SC point.

Returns:

cols (slice) – Column slice to index the high-res layer (exclusions layer) for the gid in the agg layer (supply curve layer).

static get_agg_slices(gid, shape, resolution)

Get the row, col slices of an aggregation gid.

Parameters:
  • gid (int) – Gid of interest in the aggregated layer.

  • shape (tuple) – (row, col) shape tuple of the underlying high-res layer.

  • resolution (int) – Resolution of the aggregation: number of pixels in 1D being aggregated.

Returns:

  • row_slice (slice) – Row slice to index the high-res layer for the gid in the agg layer.

  • col_slice (slice) – Col slice to index the high-res layer for the gid in the agg layer.

property gid

Supply curve point gid

property resolution

Get the supply curve grid aggregation resolution

property rows

Get the rows of the exclusions layer associated with this SC point.

Returns:

rows (slice) – Row slice to index the high-res layer (exclusions layer) for the gid in the agg layer (supply curve layer).

property sc_col_ind

Supply curve column index

Type:

int

property sc_point_gid

Supply curve point gid

Returns:

int

property sc_row_ind

Supply curve row index

Type:

int