reVX.least_cost_xmission.least_cost_paths.LeastCostPaths
- class LeastCostPaths(cost_fpath, features_fpath, clip_buffer=0)[source]
Bases:
object
Compute least cost paths between desired locations
- Parameters:
cost_fpath (str) – Path to h5 file with cost rasters and other required layers
features_fpath (str) – Path to GeoPackage with transmission features
resolution (int, optional) – SC point resolution, by default 128
clip_buffer (int, optional) – Optional number of array elements to buffer clip area by. 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
run
(cost_fpath, features_fpath, capacity_class)Find Least Cost Paths between all pairs of provided features for the given tie-line capacity class
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
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).
- property features
Table of features to compute paths for
- Returns:
pandas.DataFrame
- 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 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
- process_least_cost_paths(capacity_class, barrier_mult=100, indices=None, max_workers=None, save_paths=False)[source]
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
- classmethod run(cost_fpath, features_fpath, capacity_class, clip_buffer=0, barrier_mult=100, indices=None, max_workers=None, save_paths=False)[source]
Find Least Cost Paths between all pairs of provided features 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
capacity_class (str | int) – Capacity class of transmission features to connect supply curve points to
clip_buffer (int, optional) – Optional number of array elements to buffer clip area by. By default,
0
.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