reVX.least_cost_xmission.least_cost_xmission.ReinforcedXmission
- class ReinforcedXmission(cost_fpath, features_fpath, regions_fpath, region_identifier_column, resolution=128, xmission_config=None, min_line_length=0, allow_connections_within_states=False)[source]
Bases:
LeastCostXmission
Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC reinforcement region).
- Parameters:
cost_fpath (str) – Path to h5 file with cost rasters and other required layers.
features_fpath (str) – Path to GeoPackage with transmission features. All features except substations will be dropped. This table must have a region_identifier column which matches one of the region_identifier ID’s in the reinforcement regions GeoPackage.
regions_fpath (str) – Path to GeoPackage with reinforcement regions. This table must have the specified region_identifier column which matches the region_identifier column ID’s in the features_fpath GeoPackage.
region_identifier_column (str) – Name of column in reinforcement regions GeoPackage containing a unique identifier for each region.
resolution (int, optional) – SC point resolution. By default,
128
.xmission_config (str | dict | XmissionConfig, optional) – Path to Xmission config .json, dictionary of Xmission config .jsons, or preloaded XmissionConfig objects. By default,
None
.min_line_length (int | float, optional) – Minimum line length in km. By default,
0
.
Methods
process_least_cost_paths
(capacity_class[, ...])Find Least Cost Paths between all pairs of provided features for the given tie-line capacity class
process_sc_points
(capacity_class[, ...])Compute Least Cost Transmission for desired sc_points
run
(cost_fpath, features_fpath, ...[, ...])Find Least Cost Transmission connections between desired sc_points and substations in their reinforcement region.
Attributes
REQUIRED_LAYERS
GeoDataFrame containing the transmission features to compute the least cost paths to, starting from the start_indices (typically the centroid of the supply curve cell under consideration).
Tuple (row, col) index or list of (row, col) indices in the cost array indicating the end location(s) to compute least cost paths to (typically transmission feature locations).
Table of features to compute paths for
Table of supply curve points
Inf sink coordinates (row, col)
cKDTree for infinite sinks
Tuple of (row_idx, col_idx) in the cost array indicating the start position of all paths to compute (typically, this is the centroid of the supply curve cell under consideration).
Series mapping substations to the transmission lines connected to each substation
- classmethod run(cost_fpath, features_fpath, regions_fpath, region_identifier_column, capacity_class, resolution=128, xmission_config=None, min_line_length=0, sc_point_gids=None, clipping_buffer=1.05, barrier_mult=100, max_workers=None, simplify_geo=None, save_paths=False, radius=None, expand_radius=True)[source]
Find Least Cost Transmission connections between desired sc_points and substations in their reinforcement region.
- Parameters:
cost_fpath (str) – Path to h5 file with cost rasters and other required layers
features_fpath (str) – Path to GeoPackage with transmission features. All features except substations will be dropped. This table must have a region_identifier column which matches one of the region_identifier ID’s in the reinforcement regions GeoPackage.
regions_fpath (str) – Path to GeoPackage with reinforcement regions. This table must have the specified region_identifier column which matches the region_identifier column ID’s in the features_fpath GeoPackage.
region_identifier_column (str) – Name of column in reinforcement regions GeoPackage containing a unique identifier for each region.
capacity_class (str | int) – Capacity class of transmission features to connect supply curve points to.
resolution (int, optional) – SC point resolution. By default,
128
.xmission_config (str | dict | XmissionConfig, optional) – Path to Xmission config .json, dictionary of Xmission config .jsons, or preloaded XmissionConfig objects. By default,
None
.min_line_length (int | float, optional) – Minimum line length in km. By default,
0
.sc_point_gids (list, optional) – List of sc_point_gids to connect to. By default,
None
, which processes all points.clipping_buffer (float, optional) – Buffer to expand clipping radius by. By default,
1.05
.barrier_mult (int, optional) – Multiplier on transmission barrier costs. By default,
100
.max_workers (int, optional) – Number of workers to use for processing. If 1 run in serial, if
None
use all available cores. By default,None
.simplify_geo (float | None, optional) – If float, simplify geometries using this value.
save_paths (bool, optional) – Flag to save reinforcement line path as a multi-line geometry. By default,
False
.radius (None | int, optional) – Force clipping radius. Substations beyond this radius will not be considered for connection with supply curve point. If
None
, no radius is forced, and connections to all available transmission features are computed. By default,None
.expand_radius (bool, optional) – Option to expand radius to include at least one connection feature. Has no effect if
radius=None
. By default,True
.
- Returns:
least_costs (pandas.DataFrame | gpd.DataFrame) – Least cost connections between all supply curve points and the substations in their reinforcement region with the given capacity class.
- property end_features
GeoDataFrame containing the transmission features to compute the least cost paths to, starting from the start_indices (typically the centroid of the supply curve cell under consideration).
- Returns:
pandas.DataFrame
- property end_indices
Tuple (row, col) index or list of (row, col) indices in the cost array indicating the end location(s) to compute least cost paths to (typically transmission feature locations). Paths are computed from the start_indices (typically the centroid of the supply curve cell under consideration) to each of the individual pairs of end_indices.
- Returns:
tuple | list
- property features
Table of features to compute paths for
- Returns:
pandas.DataFrame
- process_least_cost_paths(capacity_class, barrier_mult=100, indices=None, max_workers=None, save_paths=False)
Find Least Cost Paths between all pairs of provided features for the given tie-line capacity class
- Parameters:
capacity_class (str | int) – Capacity class of transmission features to connect supply curve points to
barrier_mult (int, optional) – Transmission barrier multiplier, used when computing the least cost tie-line path, by default 100
max_workers (int, optional) – Number of workers to use for processing, if 1 run in serial, if None use all available cores, by default None
save_paths (bool, optional) – Flag to save least cost path as a multi-line geometry, by default False
- Returns:
least_cost_paths (pandas.DataFrame | gpd.GeoDataFrame) – DataFrame of lengths and costs for each path or GeoDataFrame of length, cost, and geometry for each path
- process_sc_points(capacity_class, sc_point_gids=None, nn_sinks=2, clipping_buffer=1.05, barrier_mult=100, max_workers=None, save_paths=False, radius=None, expand_radius=True, mp_delay=3, simplify_geo=None)
Compute Least Cost Transmission for desired sc_points
- Parameters:
capacity_class (str | int) – Capacity class of transmission features to connect supply curve points to
sc_point_gids (list, optional) – List of sc_point_gids to connect to, by default connect to all
nn_sinks (int, optional) – Number of nearest neighbor sinks to use for clipping radius calculation, by default 2
clipping_buffer (float, optional) – Buffer to expand clipping radius by, by default 1.05
barrier_mult (int, optional) – Transmission barrier multiplier, used when computing the least cost tie-line path, by default 100
max_workers (int, optional) – Number of workers to use for processing, if 1 run in serial, if None use all available cores, by default None
save_paths (bool, optional) – Flag to return least cost paths as a multi-line geometry, by default False
radius (None | int, optional) – Force clipping radius. Trasmission features beyond this radius will not be considered for connection with supply curve point. If
None
, no radius is forced, and connections to all available transmission features are computed. By default,None
.expand_radius (bool, optional) – Option to expand radius to include at least one connection feature. Has no effect if
radius=None
. By default,True
.mp_delay (float, optional) – Delay in seconds between starting multi-process workers. Useful for reducing memory spike at working startup.
simplify_geo (float | None, optional) – If float, simplify geometries using this value
- Returns:
least_costs (pandas.DataFrame | gpd.GeoDataFrame) – Least cost connections between all supply curve points and the transmission features with the given capacity class that are within “nn_sink” nearest infinite sinks
- property sc_points
Table of supply curve points
- Returns:
gpd.GeoDataFrame
- property sink_coords
Inf sink coordinates (row, col)
- Returns:
ndarray
- property sink_tree
cKDTree for infinite sinks
- Returns:
cKDTree
- property start_indices
Tuple of (row_idx, col_idx) in the cost array indicating the start position of all paths to compute (typically, this is the centroid of the supply curve cell under consideration). Paths will be computed from this start location to each of the end_indices, which are also locations in the cost array (typically transmission feature locations).
- Returns:
tuple
- property sub_lines_mapping
Series mapping substations to the transmission lines connected to each substation
- Returns:
pandas.Series