reVX.least_cost_xmission.trans_cap_costs.ReinforcementLineCosts
- class ReinforcementLineCosts(transmission_lines, cost_fpath, start_indices, capacity_class, row_slice, col_slice, xmission_config=None, barrier_mult=100)[source]
Bases:
TieLineCosts
Compute Least Cost Reinforcement Line cost from substations to network nodes.
The reinforcement line path will attempt to follow existing transmission lines for as long as possible. Costs are calculated using half of the greenfield cost of the transmission line that is being traced. If the reinforcement path travels along two different line voltages, corresponding costs are used for each portion of the path. In the case that the path must cross a region with no existing transmission lines to reach the destination, half (50%) of the greenfield cost of the input
capacity_class
is used.- Parameters:
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.
cost_fpath (str) – Full path of .h5 file with cost arrays.
start_indices (tuple) – 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 BA). 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 BA of the network node).
capacity_class (int | str) – Transmission feature
capacity_class
to use for the ‘base’ greenfield costs. ‘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.row_slice, col_slice (slice) – Row and column slices into the cost array representing the window to compute reinforcement line path within.
xmission_config (str | dict | XmissionConfig, optional) – Path to Xmission config .json, dictionary of Xmission config .jsons, or preloaded XmissionConfig objects. By default,
None
.barrier_mult (int, optional) – Multiplier on transmission barrier costs. By default,
100
.
Methods
compute
(end_indices[, save_paths])Compute least cost paths to given end indices
least_cost_path
(end_idx[, save_path])Find least cost path, its length, and its total (un-barriered) cost
run
(transmission_lines, cost_fpath, ...[, ...])Compute reinforcement line path to all features to be connected a single supply curve point.
Attributes
SC point capacity class
Shaped of clipped cost raster
Column index inside clipped array
Offset to apply to column indices to move into clipped array
Tie line costs array
MCP_Geometric instance initialized on mcp_cost array with starting point at sc_point
Tie line costs array with barrier costs applied for MCP analysis
Row index inside clipped array
Offset to apply to row indices to move into clipped array
- classmethod run(transmission_lines, cost_fpath, start_indices, end_indices, capacity_class, row_slice, col_slice, xmission_config=None, barrier_mult=100, save_paths=False)[source]
Compute reinforcement line path to all features to be connected a single supply curve point.
- Parameters:
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.
cost_fpath (str) – Full path of .h5 file with cost arrays.
start_indices (tuple) – 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 BA). 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 BA of the network node).
end_indices (tuple | list) – 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 BA). Paths are computed from the start_indices (typically the network node of the BA) to each of the individual pairs of end_indices.
capacity_class (int | str) – Transmission feature
capacity_class
to use for the ‘base’ greenfield costs. ‘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.row_slice, col_slice (slice) – Row and column slices into the cost array representing the window to compute reinforcement line path within.
xmission_config (str | dict | XmissionConfig, optional) – Path to Xmission config .json, dictionary of Xmission config .jsons, or preloaded XmissionConfig objects. By default,
None
.barrier_mult (int, optional) – Multiplier on transmission barrier costs. By default,
100
.save_paths (bool, optional) – Flag to save reinforcement line path as a multi-line geometry. By default,
False
.
- Returns:
tie_lines (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 capacity_class
SC point capacity class
- Returns:
str
- property clip_shape
Shaped of clipped cost raster
- Returns:
tuple
- property col
Column index inside clipped array
- Returns:
int
- property col_offset
Offset to apply to column indices to move into clipped array
- Returns:
int
- compute(end_indices, save_paths=False)
Compute least cost paths to given end indices
- Parameters:
end_indices (tuple | list) – (row, col) index or list of (row, col) indices of end point(s) to connect and compute least cost path to
save_paths (bool, optional) – Flag to save least cost path as a multi-line geometry, by default False
- Returns:
tie_lines (pandas.DataFrame | gpd.GeoDataFrame) – DataFrame of lengths and costs for each path or GeoDataFrame of length, cost, and geometry for each path
- property cost
Tie line costs array
- Returns:
ndarray
- least_cost_path(end_idx, save_path=False)
Find least cost path, its length, and its total (un-barriered) cost
- Parameters:
end_idx (Tuple[int, int]) – (row, col) index of end point to connect and compute least cost path to.
save_path (bool) – Flag to save least cost path as a multi-line geometry. By default,
False
.
- Returns:
length (float) – Length of path (km).
cost (float) – Cost of path including terrain and land use multipliers, but not barrier costs.
poi_lat, poi_lon (numpy.float64) – Latitude and longitude of the end_idx of the least cost path (i.e. the POI/transmission feature that was connected to).
path (shapely.geometry.linestring, optional) – Path as a LineString, if save_path was set to
True
.
- property mcp
MCP_Geometric instance initialized on mcp_cost array with starting point at sc_point
- Returns:
MCP_Geometric
- property mcp_cost
Tie line costs array with barrier costs applied for MCP analysis
- Returns:
ndarray
- property row
Row index inside clipped array
- Returns:
int
- property row_offset
Offset to apply to row indices to move into clipped array
- Returns:
int