reVX.least_cost_xmission.trans_cap_costs.RegionalTransCapCosts

class RegionalTransCapCosts(cost_fpath, sc_point, features, capacity_class, cost_layers, radius=None, xmission_config=None, tb_layer_name='transmission_barrier', barrier_mult=100, iso_regions_layer_name='ISO_regions', length_invariant_cost_layers=None, tracked_layers=None, cell_size=90)[source]

Bases: TransCapCosts

Compute tie-line costs when connections are limitred to a region.

This class also allows for costs for region values of 0. Additionally, the trans_gid, min_volt and max_volt columns are no longer required in the features input.

Parameters:
  • cost_fpath (str) – Full path of .h5 file with cost arrays

  • sc_point (gpd.GeoSeries) – Supply Curve Point meta data

  • features (pandas.DataFrame) – Table of transmission features to connect to supply curve point. Must have “row” and “col” columns that point to the indexs of the feature in the original cost array. Must also have a “category” column that distinguishes between substations and transmission lines.

  • capacity_class (int | str) – Transmission feature capacity_class class. Used to look up connection costs.

  • cost_layers (List[str]) – List of layers in H5 that are summed to determine total costs raster used for routing. Costs and distances for each individual layer are also reported (e.g. wet and dry costs). deteremining path using main cost layer.

  • radius (int, optional) – Radius around sc_point to clip cost to, by default None

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

  • 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

  • iso_regions_layer_name (str, default=:obj:ISO_H5_LAYER_NAME) – Name of ISO regions layer in cost_fpath file. The layer maps pixels to ISO region ID’s (1, 2, 3, 4, etc.) . By default, ISO_H5_LAYER_NAME.

  • length_invariant_cost_layers (List[str] | None, optional) – List of layers in H5 to be added to the 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.

Methods

compute([min_line_length, save_paths, ...])

Compute Transmission capital cost of connecting SC point to transmission features.

compute_connection_costs([features, ...])

Calculate connection costs for tie lines

compute_tie_line_costs([min_line_length, ...])

Compute least cost path and distance between supply curve point and every transmission feature

least_cost_path(end_idx[, save_path])

Find least cost path, its length, and its total (un-barriered) cost.

run(cost_fpath, sc_point, features, ...[, ...])

Compute Transmission capital cost of connecting SC point to transmission features.

Attributes

TRANSFORMER_COST_VOLTAGE

capacity_class

SC point capacity class

clip_mask

Polygon used to clip transmission lines to the clipped raster bounds

clip_shape

Shaped of clipped cost raster

col

Column index inside clipped array

col_offset

Offset to apply to column indices to move into clipped array

cost

Tie line costs array

features

Table of transmission features

mcp

MCP_Geometric instance initialized on mcp_cost array with starting point at sc_point

mcp_cost

Tie line costs array with barrier costs applied for MCP analysis

row

Row index inside clipped array

row_offset

Offset to apply to row indices to move into clipped array

sc_point

Supply curve point data: - gid - lat - lon - idx (row, col)

sc_point_gid

Supply curve point gid

tie_line_voltage

Tie line voltage in kV

property capacity_class

SC point capacity class

Returns:

str

property clip_mask

Polygon used to clip transmission lines to the clipped raster bounds

Returns:

shapely.Polygon

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(min_line_length=0, save_paths=False, simplify_geo=None, length_mult_kind='linear')

Compute Transmission capital cost of connecting SC point to transmission features. trans_cap_cost = tie_line_cost + connection_cost

Parameters:
  • min_line_length (float, optional) – Minimum line length in km, by default 0

  • save_paths (bool, optional) – Flag to save least cost path as a multi-line geometry, by default False

  • simplify_geo (float | None, optional) – If float, simplify geometries using this value

  • length_mult_kind ({“step”, “linear”}, default=”linear”) – Type of length multiplier calcualtion. “step” computes length multipliers using a step function, while “linear” computes the length multiplier using a linear interpolation between 0 amd 10 mile spur-line lengths. By default, "linear".

Returns:

features (pd.DataFrame | gpd.GeoDataFrame) – Transmission table with tie-line costs and distances and connection costs added. Includes paths if save_paths == True

compute_connection_costs(features=None, length_mult_kind='linear')

Calculate connection costs for tie lines

Parameters:
  • features (str, optional) – Optional features input. If None, features held by this object are used.

  • length_mult_kind ({“step”, “linear”}, default=”linear”) – Type of length multiplier calcualtion. “step” computes length multipliers using a step function, while “linear” computes the length multiplier using a linear interpolation between 0 amd 10 mile spur-line lengths. By default, "linear".

Returns:

features (pd.DataFrame) – Updated table of transmission features with the connection costs added

compute_tie_line_costs(min_line_length=0, save_paths=False) DataFrame | GeoDataFrame

Compute least cost path and distance between supply curve point and every transmission feature

Parameters:
  • min_line_length (float, optional) – Minimum line length in km, by default 0

  • save_paths (bool, optional) – Flag to save least cost path as a multi-line geometry, by default False

Returns:

tie_line_costs (gpd.GeoDataFrame) – Updated table of transmission features with the tie-line cost and distance added

property cost

Tie line costs array

Returns:

ndarray

property features: DataFrame

Table of transmission features

Returns:

pandas.DataFrame

least_cost_path(end_idx: Tuple[int, int], save_path=False) Tuple[float, float, float, float, Point | LineString | None, Dict[str, float]]

Find least cost path, its length, and its total (un-barriered) cost. Optionally, calculate separate costs for sub-layers, and geometry of path.

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 | None, optional) – Path as a LineString, if save_path was set to True.

  • cl_results (Dict[str, float]) – Costs and lengths for individual sub-layers.

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

classmethod run(cost_fpath, sc_point, features, capacity_class, cost_layers, radius=None, xmission_config=None, tb_layer_name='transmission_barrier', barrier_mult=100, iso_regions_layer_name='ISO_regions', min_line_length=0, save_paths=False, simplify_geo=None, length_invariant_cost_layers=None, tracked_layers=None, length_mult_kind='linear', cell_size=90)

Compute Transmission capital cost of connecting SC point to transmission features. trans_cap_cost = tie_line_cost + connection_cost

Parameters:
  • cost_fpath (str) – Full path of .h5 file with cost arrays

  • sc_point (gpd.GeoSeries) – Supply Curve Point meta data

  • features (pandas.DataFrame) – Table of transmission features to connect to supply curve point. Must have “row” and “col” columns that point to the indexs of the feature in the original cost array. Must also have a “category” column that distinguishes between substations and transmission lines.

  • capacity_class (int | str) – Transmission feature capacity_class class

  • cost_layers (List[str]) – List of layers in H5 that are summed to determine total costs raster used for routing. Costs and distances for each individual layer are also reported (e.g. wet and dry costs). deteremining path using main cost layer.

  • radius (int, optional) – Radius around sc_point to clip cost to, by default None

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

  • 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

  • iso_regions_layer_name (str, default=:obj:ISO_H5_LAYER_NAME) – Name of ISO regions layer in cost_fpath file. The layer maps pixels to ISO region ID’s (1, 2, 3, 4, etc.) . By default, ISO_H5_LAYER_NAME.

  • min_line_length (float, optional) – Minimum line length in km, by default 0

  • save_paths (bool, optional) – Flag to save least cost path as a multi-line geometry, by default False

  • simplify_geo (float | None, optional) – If float, simplify geometries using this value

  • length_invariant_cost_layers (List[str] | None, optional) – List of layers in H5 to be added to the 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.

  • length_mult_kind ({“step”, “linear”}, default=”linear”) – Type of length multiplier calcualtion. “step” computes length multipliers using a step function, while “linear” computes the length multiplier using a linear interpolation between 0 amd 10 mile spur-line lengths. By default, "linear".

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

Returns:

features (pd.DataFrame | gpd.GeoDataFrame | None) – Transmission table with tie-line costs and distances and connection costs added. Will include paths if save_paths == True

property sc_point

Supply curve point data: - gid - lat - lon - idx (row, col)

Returns:

pandas.Series

property sc_point_gid

Supply curve point gid

Returns:

int

property tie_line_voltage

Tie line voltage in kV

Returns:

int