reVX.least_cost_xmission.least_cost_paths.ReinforcementPaths

class ReinforcementPaths(cost_fpath, features, transmission_lines, clip_buffer=0, tb_layer_name='transmission_barrier')[source]

Bases: LeastCostPaths

Compute reinforcement line paths between substations and a single balancing area network node.

Parameters:
  • cost_fpath (str) – Path to h5 file with cost rasters and other required layers.

  • features (geopandas.GeoPackage) – GeoPackage with transmission features. The network node must be the first row of the GeoPackage - the rest should be substations that need to connect to that node.

  • transmission_lines (dict) – Dictionary where the keys are the names of cost layers in the cost HDF5 file and values are arrays with the corresponding existing transmission lines rastered into them (i.e. array value is 1 at a pixel if there is a transmission line, otherwise 0). These arrays will be used to compute the reinforcement costs along existing transmission lines of differing voltages.

  • clip_buffer (int, optional) – Optional number of array elements to buffer clip area by. By default, 0.

  • tb_layer_name (str, default=:obj:BARRIER_H5_LAYER_NAME) – Name of transmission barrier layer in cost_fpath file. This layer defines the multipliers applied to the cost layer to determine LCP routing (but does not actually affect output costs). By default, BARRIER_H5_LAYER_NAME.

Methods

process_least_cost_paths(capacity_class, ...)

Find the reinforcement line paths between the network node and the substations for the given tie-line capacity class

run(cost_fpath, features_fpath, ...[, ...])

Find the reinforcement line paths between the network node and the substations for the given tie-line capacity class

Attributes

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

end_indices

Tuple (row, col) index or list of (row, col) indices in the cost array indicating the end location(s) to compute reinforcement line paths to (typically substations within a single reinforcement region).

features

Table of features to compute paths for

start_indices

Tuple of (row_idx, col_idx) in the cost array indicating the start position of all reinforcement line paths to compute (typically, this is the location of the network node in the reinforcement region).

property start_indices

Tuple of (row_idx, col_idx) in the cost array indicating the start position of all reinforcement line paths to compute (typically, this is the location of the network node in the reinforcement region). Paths will be computed from this start location to each of the end_indices, which are also locations in the cost array (typically substations within the reinforcement region of the network node).

Returns:

tuple

property end_indices

Tuple (row, col) index or list of (row, col) indices in the cost array indicating the end location(s) to compute reinforcement line paths to (typically substations within a single reinforcement region). Paths are computed from the start_indices (typically the network node of the reinforcement region) to each of the individual pairs of end_indices.

Returns:

tuple | list

process_least_cost_paths(capacity_class, cost_layers, barrier_mult=100, max_workers=None, save_paths=False, length_invariant_cost_layers=None, tracked_layers=None, cell_size=90)[source]

Find the reinforcement line paths between the network node and the substations for the given tie-line capacity class

Parameters:
  • capacity_class (int | str) – Capacity class of the ‘base’ greenfield costs layer. Costs will be scaled by the capacity corresponding to this class to report reinforcement costs as $/MW.

  • cost_layers (List[str]) – List of layers in H5 that are summed to determine total ‘base’ greenfield costs raster used for routing. ‘Base’ greenfield costs are only used if the reinforcement path must deviate from existing transmission lines. Typically, a capacity class of 400 MW (230kV transmission line) is used for the base greenfield costs.

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

  • save_paths (bool, optional) – Flag to save reinforcement line path as a multi-line geometry. By default, False.

  • length_invariant_cost_layers (List[str] | None, optional) – List of layers in H5 to be added to the ‘base’ greenfield cost raster. The costs specified by these layers are not scaled with distance traversed across the cell (i.e. fixed one-time costs for crossing these cells).

  • tracked_layers (dict, optional) – Dictionary mapping layer names to strings, where the strings are numpy methods that should be applied to the layer along the LCP. For example, tracked_layers={'layer_1': 'mean', 'layer_2': 'max} would report the average of layer_1 values along the least cost path and the max of layer_2 values along the least cost path. Examples of numpy methods (non-exhaustive):

    • mean

    • max

    • min

    • mode

    • median

    • std

    By default, None, which does not track any extra layers.

  • cell_size (int, optional) – Side length of each cell, in meters. Cells are assumed to be square. By default, CELL_SIZE.

Returns:

least_cost_paths (pandas.DataFrame | gpd.GeoDataFrame) – DataFrame of lengths and costs for each reinforcement line path or GeoDataFrame of length, cost, and geometry for each reinforcement line path.

classmethod run(cost_fpath, features_fpath, network_nodes_fpath, region_identifier_column, transmission_lines_fpath, capacity_class, cost_layers, xmission_config=None, clip_buffer=0, tb_layer_name='transmission_barrier', barrier_mult=100, indices=None, max_workers=None, save_paths=False, length_invariant_cost_layers=None, tracked_layers=None, ss_id_col='poi_gid', cell_size=90)[source]

Find the reinforcement line paths between the network node and the substations for the given tie-line capacity class

Parameters:
  • cost_fpath (str) – Path to h5 file with cost rasters and other required layers.

  • features_fpath (str) – Path to GeoPackage with transmission features. The network node must be the first row of the GeoPackage - the rest should be substations that need to connect to that node. This table must have a region_identifier_column column which matches the region_identifier_column ID of the network node to the region_identifier_column ID of the substations that should connect to it.

  • network_nodes_fpath (str) – Path to GeoPackage with network node endpoints. The endpoints should have a region_identifier_column column that identifies matches exactly one of the ID’s in the reinforcement regions GeoPackage to be used in downstream models.

  • region_identifier_column (str) – Name of column in network_nodes_fpath GeoPackage containing a unique identifier for each region.

  • capacity_class (int | str) – Capacity class of the ‘base’ greenfield costs layer. Costs will be scaled by the capacity corresponding to this class to report reinforcement costs as $/MW.

  • cost_layers (List[str]) – List of layers in H5 that are summed to determine total ‘base’ greenfield costs raster used for routing. ‘Base’ greenfield costs are only used if the reinforcement path must deviate from existing transmission lines. Typically, a capacity class of 400 MW (230kV transmission line) is used for the base greenfield costs.

  • xmission_config (str | dict | XmissionConfig, optional) – Path to Xmission config .json, dictionary of Xmission config .jsons, or preloaded XmissionConfig objects. By default, None.

  • clip_buffer (int, optional) – Optional number of array elements to buffer clip area by. By default, 0.

  • tb_layer_name (str, default=:obj:BARRIER_H5_LAYER_NAME) – Name of transmission barrier layer in cost_fpath file. This layer defines the multipliers applied to the cost layer to determine LCP routing (but does not actually affect output costs). By default, BARRIER_H5_LAYER_NAME.

  • barrier_mult (int, optional) – Multiplier on transmission barrier costs. By default, 100.

  • indices (iterable, optonal) – Indices corresponding to the network nodes that should be processed. By default None, which process all network nodes.

  • 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 reinforcement line path as a multi-line geometry. By default, False.

  • length_invariant_cost_layers (List[str] | None, optional) – List of layers in H5 to be added to the ‘base’ greenfield cost raster. The costs specified by these layers are not scaled with distance traversed across the cell (i.e. fixed one-time costs for crossing these cells).

  • tracked_layers (dict, optional) – Dictionary mapping layer names to strings, where the strings are numpy methods that should be applied to the layer along the LCP. For example, tracked_layers={'layer_1': 'mean', 'layer_2': 'max} would report the average of layer_1 values along the least cost path and the max of layer_2 values along the least cost path. Examples of numpy methods (non-exhaustive):

    • mean

    • max

    • min

    • mode

    • median

    • std

    By default, None, which does not track any extra layers.

  • ss_id_col (str, default=”poi_gid”) – Name of column containing unique identifier for each substation. This column will be used to compute minimum reinforcement cost per substation. By default, "poi_gid".

  • cell_size (int, optional) – Side length of each cell, in meters. Cells are assumed to be square. By default, CELL_SIZE.

Returns:

least_cost_paths (pandas.DataFrame | gpd.GeoDataFrame) – DataFrame of lengths and costs for each reinforcement line path or GeoDataFrame of length, cost, and geometry for each reinforcement line path.

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 features

Table of features to compute paths for

Returns:

pandas.DataFrame