reV.supply_curve.extent.SupplyCurveExtent

class SupplyCurveExtent(f_excl, resolution=64)[source]

Bases: object

Supply curve full extent framework. This class translates the 90m exclusion grid to the aggregated supply curve resolution.

Parameters:
  • f_excl (str | list | tuple | ExclusionLayers) – File path(s) to the exclusions grid, or pre-initialized ExclusionLayers. The exclusions dictate the SC analysis extent.

  • 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.

Methods

close()

Close all file handlers.

get_coord(gid)

Get the centroid coordinate for the supply curve gid point.

get_excl_points(dset, gid)

Get the exclusions data corresponding to a supply curve gid.

get_excl_slices(gid)

Get the row and column slices of the exclusions grid corresponding to the supply curve point gid.

get_flat_excl_ind(gid)

Get the index values of the flattened exclusions grid corresponding to the supply curve point gid.

get_sc_row_col_ind(gid)

Get the supply curve grid row and column index values corresponding to a supply curve gid.

get_slice_lookup(sc_point_gids)

Get exclusion slices for all requested supply curve point gids

valid_sc_points(tm_dset)

Determine which sc_point_gids contain resource gids and are thus valid supply curve points

Attributes

col_indices

Get a 1D array of col indices for every gid.

cols_of_excl

List representing the supply curve points columns and which exclusions columns belong to each supply curve column.

excl_col_slices

List representing the supply curve points cols and which exclusions cols belong to each supply curve col.

excl_cols

Get the unique column indices identifying the exclusion points.

excl_row_slices

List representing the supply curve points rows and which exclusions rows belong to each supply curve row.

excl_rows

Get the unique row indices identifying the exclusion points.

excl_shape

Get the shape tuple of the exclusion file raster.

exclusions

Get the exclusions object.

lat_lon

2D array of lat, lon coordinates for all sc points

latitude

Get supply curve point latitudes

longitude

Get supply curve point longitudes

n_cols

Get the number of supply curve grid columns.

n_rows

Get the number of supply curve grid rows.

points

Get the summary dataframe of supply curve points.

resolution

Get the 1D resolution.

row_indices

Get a 1D array of row indices for every gid.

rows_of_excl

List representing the supply curve points rows and which exclusions rows belong to each supply curve row.

shape

Get the Supply curve shape tuple (n_rows, n_cols).

close()[source]

Close all file handlers.

property shape

Get the Supply curve shape tuple (n_rows, n_cols).

Returns:

shape (tuple) – 2-entry tuple representing the full supply curve extent.

property exclusions

Get the exclusions object.

Returns:

_excls (ExclusionLayers) – ExclusionLayers h5 handler object.

property resolution

Get the 1D resolution.

Returns:

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

property excl_shape

Get the shape tuple of the exclusion file raster.

Returns:

tuple

property excl_rows

Get the unique row indices identifying the exclusion points.

Returns:

excl_rows (np.ndarray) – Array of exclusion row indices.

property excl_cols

Get the unique column indices identifying the exclusion points.

Returns:

excl_cols (np.ndarray) – Array of exclusion column indices.

property rows_of_excl

List representing the supply curve points rows and which exclusions rows belong to each supply curve row.

Returns:

_rows_of_excl (list) – List representing the supply curve points rows. Each list entry contains the exclusion row indices that are included in the sc point.

property cols_of_excl

List representing the supply curve points columns and which exclusions columns belong to each supply curve column.

Returns:

_cols_of_excl (list) – List representing the supply curve points columns. Each list entry contains the exclusion column indices that are included in the sc point.

property excl_row_slices

List representing the supply curve points rows and which exclusions rows belong to each supply curve row.

Returns:

_excl_row_slices (list) – List representing the supply curve points rows. Each list entry contains the exclusion row slice that are included in the sc point.

property excl_col_slices

List representing the supply curve points cols and which exclusions cols belong to each supply curve col.

Returns:

_excl_col_slices (list) – List representing the supply curve points cols. Each list entry contains the exclusion col slice that are included in the sc point.

property n_rows

Get the number of supply curve grid rows.

Returns:

n_rows (int) – Number of row entries in the full supply curve grid.

property n_cols

Get the number of supply curve grid columns.

Returns:

n_cols (int) – Number of column entries in the full supply curve grid.

property latitude

Get supply curve point latitudes

Returns:

ndarray

property longitude

Get supply curve point longitudes

Returns:

ndarray

property lat_lon

2D array of lat, lon coordinates for all sc points

Returns:

ndarray

property row_indices

Get a 1D array of row indices for every gid. That is, this property has length == len(gids) and row_indices[sc_gid] yields the row index of the target supply curve gid

Returns:

ndarray

property col_indices

Get a 1D array of col indices for every gid. That is, this property has length == len(gids) and col_indices[sc_gid] yields the col index of the target supply curve gid

Returns:

ndarray

property points

Get the summary dataframe of supply curve points.

Returns:

_points (pd.DataFrame) – Supply curve points with columns for attributes of each sc point.

get_sc_row_col_ind(gid)[source]

Get the supply curve grid row and column index values corresponding to a supply curve gid.

Parameters:

gid (int) – Supply curve point gid.

Returns:

  • row_ind (int) – Row index that the gid is located at in the sc grid.

  • col_ind (int) – Column index that the gid is located at in the sc grid.

get_excl_slices(gid)[source]

Get the row and column slices of the exclusions grid corresponding to the supply curve point gid.

Parameters:

gid (int) – Supply curve point gid.

Returns:

  • row_slice (slice) – Exclusions grid row slice corresponding to the sc point gid.

  • col_slice (slice) – Exclusions grid col slice corresponding to the sc point gid.

get_flat_excl_ind(gid)[source]

Get the index values of the flattened exclusions grid corresponding to the supply curve point gid.

Parameters:

gid (int) – Supply curve point gid.

Returns:

excl_ind (np.ndarray) – Index values of the flattened exclusions grid corresponding to the SC gid.

get_excl_points(dset, gid)[source]

Get the exclusions data corresponding to a supply curve gid.

Parameters:
  • dset (str | int) – Used as the first arg in the exclusions __getitem__ slice. String can be “meta”, integer can be layer number.

  • gid (int) – Supply curve point gid.

Returns:

excl_points (pd.DataFrame) – Exclusions data reduced to just the exclusion points associated with the requested supply curve gid.

get_coord(gid)[source]

Get the centroid coordinate for the supply curve gid point.

Parameters:

gid (int) – Supply curve point gid.

Returns:

coord (tuple) – Two entry coordinate tuple: (latitude, longitude)

valid_sc_points(tm_dset)[source]

Determine which sc_point_gids contain resource gids and are thus valid supply curve points

Parameters:

tm_dset (str) – Techmap dataset name

Returns:

valid_gids (ndarray) – Vector of valid sc_point_gids that contain resource gis

get_slice_lookup(sc_point_gids)[source]

Get exclusion slices for all requested supply curve point gids

Parameters:

sc_point_gids (list | ndarray) – List or 1D array of sc_point_gids to get exclusion slices for

Returns:

dict – lookup mapping sc_point_gid to exclusion slice