atra.analysis package

Submodules

atra.analysis.adaptation_analysis module

Assess national adaptation options

main()[source]
  1. estimated cost to upgrade to a climate-resilient bituminous 2L (applied to unpaved, gravel and bituminous 2L roads),
  2. estimated cost to upgrade to a climate-resilient bituminous 4L
(applied to bituminous 4L roads),
  1. estimated cost to upgrade to a climate-resilient concrete 2L
(applied to concrete 2L roads),
  1. estimated cost to upgrade to a climate-resilient concrete 4L
(applied to concrete 4L roads).

atra.analysis.collect_network_hazard_scenarios_national module

Collect network hazard scenarios

main()[source]

Process results

  1. Specify the paths from where you to read and write:
    • Input data
    • Intermediate calcuations data
    • Output results
  2. Supply input data and parameters
    • Names of the three Provinces - List of string types
    • Names of modes - List of strings
    • Names of output modes - List of strings
    • Names of hazard bands - List of integers
    • Names of hazard thresholds - List of integers
    • Condition ‘Yes’ or ‘No’ is the users wants to process results
  3. Give the paths to the input data files:
    • Commune boundary and stats data shapefile
    • Hazard datasets description Excel file
    • String name of sheet in hazard datasets description Excel file

atra.analysis.economic_failure_combine_national module

Combine national-scale macroeconomic loss estimates with rerouting losses

correct_economic_loss_estimates(x)[source]
main()[source]

Process results

atra.analysis.failure_estimation module

Failure analysis of national-scale networks For transport modes at national scale:

  • road
  • rail

Input data requirements

  1. Correct paths to all files and correct input parameters

  2. csv sheets with results of flow mapping based on MIN-MAX generalised costs estimates:

    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • origin_province - String name of Province of Origin node ID
    • destination_province - String name of Province of Destination node ID
    • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
    • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
    • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
    • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
    • min_time - Float values of estimated time for paths with minimum generalised cost flows
    • max_time - Float values of estimated time for paths with maximum generalised cost flows
    • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
    • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows
    • industry_columns - All daily tonnages of industry columns given in the OD matrix data
  3. Shapefiles

    • edge_id - String/Integer/Float Edge ID
    • geometry - Shapely LineString geomtry of edges

Results

Csv sheets with results of failure analysis:

  1. All failure scenarios

    • edge_id - String name or list of failed edges
    • origin - String node ID of Origin of disrupted OD flow
    • destination - String node ID of Destination of disrupted OD flow
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_distance - Float value of estimated distance of OD journey before disruption
    • min/max_time - Float value of estimated time of OD journey before disruption
    • min/max_gcost - Float value of estimated travel cost of OD journey before disruption
    • new_cost - Float value of estimated cost of OD journey after disruption
    • new_distance - Float value of estimated distance of OD journey after disruption
    • new_path - List of string edge ID’s of estimated new route of OD journey after disruption
    • new_time - Float value of estimated time of OD journey after disruption
    • dist_diff - Float value of Post disruption minus per-disruption distance
    • time_diff - Float value Post disruption minus per-disruption timee
    • min/max_tr_loss - Float value of estimated change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
  2. Isolated OD scenarios - OD flows with no rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  3. Rerouting scenarios - OD flows with rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • min/max_tr_loss - Float value of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  4. Min-max combined scenarios - Combined min-max results along each edge

    • edge_id - String name or list of failed edges
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_tr_loss - Float values of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages affted by disrupted edge
main()[source]

Estimate failures

Specify the paths from where you want to read and write:

  1. Input data
  2. Intermediate calcuations data
  3. Output results

Supply input data and parameters

  1. Names of modes
    String
  2. Names of min-max tons columns in sector data
    List of string types
  3. Min-max names of names of different types of attributes - paths, distance, time, cost, tons
    List of string types
  4. Names of commodity/industry columns for which min-max tonnage column names already exist
    List of string types
  5. Percentage of OD flows that are assumed disrupted
    List of float type
  6. Condition on whether analysis is single failure or multiple failure
    Boolean condition True or False

Give the paths to the input data files:

  1. Network edges csv and shapefiles
  2. OD flows csv file
  3. Failure scenarios csv file

Specify the output files and paths to be created

atra.analysis.failure_estimation_bridges module

Failure analysis of national-scale networks For transport modes at national scale:

  • road
  • rail

Input data requirements

  1. Correct paths to all files and correct input parameters

  2. Excel sheets with results of flow mapping based on MIN-MAX generalised costs estimates:

    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • o_region - String name of Province of Origin node ID
    • d_region - String name of Province of Destination node ID
    • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
    • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
    • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
    • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
    • min_time - Float values of estimated time for paths with minimum generalised cost flows
    • max_time - Float values of estimated time for paths with maximum generalised cost flows
    • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
    • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows
    • min_vehicle_nums - Float values of estimated vehicle numbers for paths with minimum generalised cost flows
    • max_vehicle_nums - Float values of estimated vehicle numbers for paths with maximum generalised cost flows
    • industry_columns - All daily tonnages of industry columns given in the OD matrix data
  3. Shapefiles

    • edge_id - String/Integer/Float Edge ID
    • geometry - Shapely LineString geomtry of edges

Results

Csv sheets with results of failure analysis:

  1. All failure scenarios

    • edge_id - String name or list of failed edges
    • origin - String node ID of Origin of disrupted OD flow
    • destination - String node ID of Destination of disrupted OD flow
    • o_region - String name of Province of Origin node ID of disrupted OD flow
    • d_region - String name of Province of Destination node ID of disrupted OD flow
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_distance - Float value of estimated distance of OD journey before disruption
    • min/max_time - Float value of estimated time of OD journey before disruption
    • min/max_gcost - Float value of estimated travel cost of OD journey before disruption
    • min/max_vehicle_nums - Float value of estimated vehicles of OD journey before disruption
    • new_cost - Float value of estimated cost of OD journey after disruption
    • new_distance - Float value of estimated distance of OD journey after disruption
    • new_path - List of string edge ID’s of estimated new route of OD journey after disruption
    • new_time - Float value of estimated time of OD journey after disruption
    • dist_diff - Float value of Post disruption minus per-disruption distance
    • time_diff - Float value Post disruption minus per-disruption timee
    • min/max_tr_loss - Float value of estimated change in rerouting cost
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  2. Isolated OD scenarios - OD flows with no rerouting options

    • edge_id - String name or list of failed edges
    • o_region - String name of Province of Origin node ID of disrupted OD flow
    • d_region - String name of Province of Destination node ID of disrupted OD flow
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  3. Rerouting scenarios - OD flows with rerouting options

    • edge_id - String name or list of failed edges
    • o_region - String name of Province of Origin node ID of disrupted OD flow
    • d_region - String name of Province of Destination node ID of disrupted OD flow
    • min/max_tr_loss - Float value of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  4. Min-max combined scenarios - Combined min-max results along each edge

    • edge_id - String name or list of failed edges
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_tr_loss - Float values of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages affted by disrupted edge
  5. Shapefile Min-max combined scenarios - Combined min-max reults along each edge
    • edge_id - String name or list of failed edges
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_tr_loss - Float values of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages affted by disrupted edge
    • geometry - Shapely LineString geomtry of edges
main()[source]

Estimate failures

Specify the paths from where you want to read and write:

  1. Input data
  2. Intermediate calcuations data
  3. Output results

Supply input data and parameters

  1. Names of modes
    List of strings
  2. Unit weight of vehicle assumed for each mode
    List of float types
  3. Range of usage factors for each mode to represent uncertainty in cost estimations
    List of tuples of float types
  4. Min-max names of names of different types of attributes - paths, distance, time, cost, vehicles, tons
    List of string types
  5. Names of commodity/industry columns for which min-max tonnage column names already exist
    List of string types
  6. Percentage of OD flows that are assumed disrupted
    List of float type
  7. Condition on whether analysis is single failure or multiple failure
    Boolean condition True or False

Give the paths to the input data files:

  1. Network edges Excel and shapefiles
  2. OD flows Excel file
  3. Costs of modes Excel file
  4. Road properties Excel file
  5. Failure scenarios Excel file

Specify the output files and paths to be created

atra.analysis.failure_estimation_dnv_flooded_roads module

Failure analysis of national-scale networks For transport modes at national scale:

  • road
  • rail

Input data requirements

  1. Correct paths to all files and correct input parameters

  2. csv sheets with results of flow mapping based on MIN-MAX generalised costs estimates:

    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • origin_province - String name of Province of Origin node ID
    • destination_province - String name of Province of Destination node ID
    • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
    • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
    • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
    • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
    • min_time - Float values of estimated time for paths with minimum generalised cost flows
    • max_time - Float values of estimated time for paths with maximum generalised cost flows
    • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
    • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows
    • industry_columns - All daily tonnages of industry columns given in the OD matrix data
  3. Shapefiles

    • edge_id - String/Integer/Float Edge ID
    • geometry - Shapely LineString geomtry of edges

Results

Csv sheets with results of failure analysis:

  1. All failure scenarios

    • edge_id - String name or list of failed edges
    • origin - String node ID of Origin of disrupted OD flow
    • destination - String node ID of Destination of disrupted OD flow
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_distance - Float value of estimated distance of OD journey before disruption
    • min/max_time - Float value of estimated time of OD journey before disruption
    • min/max_gcost - Float value of estimated travel cost of OD journey before disruption
    • new_cost - Float value of estimated cost of OD journey after disruption
    • new_distance - Float value of estimated distance of OD journey after disruption
    • new_path - List of string edge ID’s of estimated new route of OD journey after disruption
    • new_time - Float value of estimated time of OD journey after disruption
    • dist_diff - Float value of Post disruption minus per-disruption distance
    • time_diff - Float value Post disruption minus per-disruption timee
    • min/max_tr_loss - Float value of estimated change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
  2. Isolated OD scenarios - OD flows with no rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  3. Rerouting scenarios - OD flows with rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • min/max_tr_loss - Float value of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  4. Min-max combined scenarios - Combined min-max results along each edge

    • edge_id - String name or list of failed edges
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_tr_loss - Float values of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages affted by disrupted edge
main()[source]

Estimate failures

Specify the paths from where you want to read and write:

  1. Input data
  2. Intermediate calcuations data
  3. Output results

Supply input data and parameters

  1. Names of modes
    String
  2. Names of min-max tons columns in sector data
    List of string types
  3. Min-max names of names of different types of attributes - paths, distance, time, cost, tons
    List of string types
  4. Names of commodity/industry columns for which min-max tonnage column names already exist
    List of string types
  5. Percentage of OD flows that are assumed disrupted
    List of float type
  6. Condition on whether analysis is single failure or multiple failure
    Boolean condition True or False

Give the paths to the input data files:

  1. Network edges csv and shapefiles
  2. OD flows csv file
  3. Failure scenarios csv file

Specify the output files and paths to be created

atra.analysis.flow_mapping module

Map flows on national networks

Purpose

Mapping the OD node level matrix values to network paths

For all transport modes at national scale: [‘road’, ‘rail’, ‘port’]

The code estimates 2 values - A MIN and a MAX value of flows between each selected OD node pair
  • Based on MIN-MAX generalised costs estimates

Input data requirements

  1. Correct paths to all files and correct input parameters
  2. Excel file with mode sheets containing network graph structure and attributes
    • edge_id - String Edge ID
    • from_node - String node ID that should be present in node_id column
    • to_node - String node ID that should be present in node_id column
    • length - Float length of edge in km
    • min_time - Float minimum time of travel in hours on edge
    • max_time - Float maximum time of travel in hours on edge
    • min_time_cost - Float minimum cost of time in USD on edge
    • max_time_cost - Float maximum cost of time in USD on edge
    • min_tariff_cost - Float minimum tariff cost in USD on edge
    • max_tariff_cost - Float maximum tariff cost in USD on edge
  3. Edge shapefiles for all national-scale networks with attributes:
    • edge_id - String Edge ID
    • geometry - Shapely LineString geometry of edges
  4. Excel file with mode sheets containing node-level OD values with attributes:
    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • min_tons - Float values of minimum daily OD in tons
    • max_tons - Float values of maximum daily OD in tons
    • Names of the industry columns specified in the inputs

Results

  1. Excel sheets with results of flow mapping based on MIN-MAX generalised costs estimates:
    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • origin_province - String name of Province of Origin node ID
    • destination_province - String name of Province of Destination node ID
    • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
    • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
    • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
    • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
    • min_time - Float values of estimated time for paths with minimum generalised cost flows
    • max_time - Float values of estimated time for paths with maximum generalised cost flows
    • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
    • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows
    • industry_columns - All daily tonnages of industry columns given in the OD matrix data
  2. Shapefiles
    • edge_id - String/Integer/Float Edge ID
    • geometry - Shapely LineString geomtry of edges
    • min_{industry} - Float values of estimated minimum daily industries/commodities/total volumes in tons on edges
    • max_{industry} - Float values of estimated maximum daily industries/commodities/total volumes in tons on edges

References

  1. Pant, R., Koks, E.E., Paltan, H., Russell, T. & Hall, J.W. (2019). Transport risk analysis in Argentina. Final Report, Oxford Infrastructure Analytics Ltd., Oxford, UK.
  2. All input data folders and files referred to in the code below.
main()[source]

Estimate flows

  1. Specify the paths from where you want to read and write:
    • Input data
    • Intermediate calcuations data
    • Output results
  2. Supply input data and parameters
    • Percentage of OD flow we want to send along path: FLoat type
    • Names of modes: List of dictionaries
    • Names of min-max tonnage column names in OD data
  3. Give the paths to the input data files:
    • Network edges csv files
    • OD daily flows csv file
  4. Specify the output files and paths to be created
network_od_paths_assembly(points_dataframe, graph, transport_mode, min_tons_column, max_tons_column, csv_output_path='')[source]

Assemble estimates of OD paths, distances, times, costs and tonnages on networks

Parameters:
  • points_dataframe (pandas.DataFrame) – OD nodes and their tonnages
  • graph – igraph network structure
  • region_name (str) – name of Province
  • excel_writer – Name of the excel writer to save Pandas dataframe to Excel file
Returns:

save_paths_df

  • origin - String node ID of Origin
  • destination - String node ID of Destination
  • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
  • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
  • min_netrev - Float values of estimated netrevenue for paths with minimum generalised cost flows
  • max_netrev - Float values of estimated netrevenue for paths with maximum generalised cost flows
  • min_croptons - Float values of estimated crop tons for paths with minimum generalised cost flows
  • max_croptons - Float values of estimated crop tons for paths with maximum generalised cost flows
  • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
  • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
  • min_time - Float values of estimated time for paths with minimum generalised cost flows
  • max_time - Float values of estimated time for paths with maximum generalised cost flows
  • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
  • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows

Return type:

pandas.DataFrame

atra.analysis.hazards_network_intersections_results_collect module

Summarise network-hazard intersections

Purpose

Collect network-hazard intersection attributes
  • Combine with boundary Polygons to collect network-hazard-boundary intersection attributes
  • Write final results to an Excel sheet

Input data requirements

  1. Correct paths to all files and correct input parameters
  2. Shapefiles of network-hazard intersections results with attributes:
    • edge_id or node_id - String/Integer/Float Edge ID or Node ID of network
    • length - Float length of edge intersecting with hazards
    • geometry - Shapely geometry of edges as LineString or nodes as Points
  3. Shapefile of administrative boundaries of Argentina with attributes:
    • province_i - String/Integer ID of Province
    • pro_name_e - String name of Province in English
    • district_i - String/Integer ID of District
    • dis_name_e - String name of District in English
    • commune_id - String/Integer ID of Commune
    • name_eng - String name of Commune in English
    • geometry - Shapely geometry of boundary Polygon
  4. Excel sheet of hazard attributes with attributes:
    • hazard_type - String name of hazard type
    • model - String name of hazard model
    • year - String name of hazard year
    • climate_scenario - String name of hazard scenario
    • probability - Float/String value of hazard probability
    • band_num - Integer value of hazard band
    • min_val - Integer value of minimum value of hazard threshold
    • max_val - Integer value of maximum value of hazard threshold

Results

  1. Excel sheet of network-hazard-boundary intersection with attributes:
    • edge_id/node_id - String name of intersecting edge ID or node ID
    • length - Float length of intersection of edge LineString and hazard Polygon: Only for edges
    • province_id - String/Integer ID of Province
    • province_name - String name of Province in English
    • district_id - String/Integer ID of District
    • district_name - String name of District in English
    • commune_id - String/Integer ID of Commune
    • commune_name - String name of Commune in English
    • sector - String name of transport mode
    • hazard_type - String name of hazard type
    • model - String name of hazard model
    • year - String name of hazard year
    • climate_scenario - String name of hazard scenario
    • probability - Float/String value of hazard probability
    • band_num - Integer value of hazard band
    • min_val - Integer value of minimum value of hazard threshold
    • max_val - Integer value of maximum value of hazard threshold
create_hazard_attributes_for_network(intersection_dir, climate_scenario, year, sector, hazard_files, hazard_df, thresholds, commune_shape, network_id_column, network_type='')[source]

Extract results of network edges/nodes and hazard intersections to collect network-hazard intersection attributes

  • Combine with boundary Polygons to collect network-hazard-boundary intersection attributes
  • Write final results to an Excel sheet
Parameters:
  • intersection_dir (str) – Path to Directory where the network-hazard shapefile results are stored
  • sector (str) – name of transport mode
  • hazard_files (list[str]) – names of all hazard files
  • hazard_df (pandas.DataFrame) – hazard attributes
  • bands (list[int]) – integer values of hazard bands
  • thresholds (list[int]) – integer values of hazard thresholds
  • commune_shape – Shapefile of commune boundaries and attributes
  • network_type (str, optional) – value -‘edges’ or ‘nodes’: Default = ‘nodes’
  • name_province (str, optional) – name of province if needed: Default = ‘’
Returns:

data_df

network-hazard-boundary intersection attributes:
  • edge_id/node_id - String name of intersecting edge ID or node ID
  • length - Float length of intersection of edge LineString and hazard Polygon: Only for edges
  • province_id - String/Integer ID of Province
  • province_name - String name of Province in English
  • district_id - String/Integer ID of District
  • district_name - String name of District in English
  • commune_id - String/Integer ID of Commune
  • commune_name - String name of Commune in English
  • sector - String name of transport mode
  • hazard_type - String name of hazard type
  • model - String name of hazard model
  • year - String name of hazard year
  • climate_scenario - String name of hazard scenario
  • probability - Float/String value of hazard probability
  • band_num - Integer value of hazard band
  • min_val - Integer value of minimum value of hazard threshold
  • max_val - Integer value of maximum value of hazard threshold
  • length - Float length of intersection of edge LineString and hazard Polygon: Only for edges

Return type:

pandas.DataFrame

main()[source]

Collect results

  1. Specify the paths from where you to read and write:
    • Input data
    • Intermediate calcuations data
    • Output results
  2. Supply input data and parameters
    • Names of the three Provinces - List of string types
    • Names of modes - List of strings
    • Names of output modes - List of strings
    • Names of hazard bands - List of integers
    • Names of hazard thresholds - List of integers
    • Condition ‘Yes’ or ‘No’ is the users wants to process results
  3. Give the paths to the input data files:
    • Commune boundary and stats data shapefile
    • Hazard datasets description Excel file
    • String name of sheet in hazard datasets description Excel file

atra.analysis.hazards_networks_intersections module

Intersect networks with hazards

Purpose

Intersect hazards and network line and point geometries with hazatd polygons

Write final results to Shapefiles

Input data requirements

  1. Correct paths to all files and correct input parameters
  2. Shapefiles of network edges or nodes with attributes:
    • edge_id or node_id - String/Integer/Float Edge ID or Node ID of network
    • geometry - Shapely geometry of edges as LineStrings or nodes as Points
  3. Shapefile of hazards with attributes:
    • geometry - Shapely geometry of hazard Polygon

Results

  1. Edge shapefiles with attributes:
    • edge_id - String name of intersecting edge ID
    • length - Float length of intersection of edge LineString and hazard Polygon
    • geometry - Shapely LineString geometry of intersection of edge LineString and hazard Polygon
  2. Node Shapefile with attributes:
    • node_id - String name of intersecting node ID
    • geometry - Shapely Point geometry of intersecting node ID
intersect_networks_and_all_hazards(hazard_dir, network_file_path, network_file_name, output_file_path, network_id_column, network_type='')[source]

Walk through all hazard files and select network-hazard intersection criteria

Parameters:
  • hazard_dir (str) – name of directory where all hazard shapefiles are stored
  • network_file_path (str) – name of directory where network shapefile is stored
  • network_file_name (str) – name network shapefile
  • output_file_path (str) – name of directory where network-hazard instersection result shapefiles will be stored
  • network_type (str) – values of ‘edges’ or ‘nodes’

Edge or Node shapefiles

main()[source]

Intersect networks with hazards

  1. Specify the paths from where you to read and write:
    • Input data
    • Intermediate calcuations data
    • Output results
  2. Supply input data and parameters
    • Names of modes - List of strings
    • Names of mode id columns - List of strings
    • Condition ‘Yes’ or ‘No’ is the users wants to process results
  3. Give the paths to the input data files:
    • Hazard directory
    • Paths to the network shapefiles
networkedge_hazard_intersection(edge_shapefile, hazard_shapefile, output_shapefile, edge_id_column)[source]

Intersect network edges and hazards and write results to shapefiles

Parameters:
  • edge_shapefile – Shapefile of network LineStrings
  • hazard_shapefile – Shapefile of hazard Polygons
  • output_shapefile – String name of edge-hazard shapefile for storing results
output_shapefile
  • edge_id - String name of intersecting edge ID
  • length - Float length of intersection of edge LineString and hazard Polygon
  • geometry - Shapely LineString geometry of intersection of edge LineString and hazard Polygon
networknode_hazard_intersection(node_shapefile, hazard_shapefile, output_shapefile, node_id_column)[source]

Intersect network nodes and hazards and write results to shapefiles

Parameters:
  • node_shapefile – Shapefile of network Points
  • hazard_shapefile – Shapefile of hazard Polygons
  • output_shapefile – String name of node-hazard shapefile for storing results
output_shapefile
  • node_id - String name of intersecting node ID
  • geometry - Shapely Point geometry of intersecting node ID

atra.analysis.multi_modal_failure_estimation module

Failure analysis of national-scale networks For transport modes at national scale:

  • rail
  • Can do raod as well

Input data requirements

  1. Correct paths to all files and correct input parameters

  2. csv sheets with results of flow mapping based on MIN-MAX generalised costs estimates:

    • origin - String node ID of Origin
    • destination - String node ID of Destination
    • origin_province - String name of Province of Origin node ID
    • destination_province - String name of Province of Destination node ID
    • min_edge_path - List of string of edge ID’s for paths with minimum generalised cost flows
    • max_edge_path - List of string of edge ID’s for paths with maximum generalised cost flows
    • min_distance - Float values of estimated distance for paths with minimum generalised cost flows
    • max_distance - Float values of estimated distance for paths with maximum generalised cost flows
    • min_time - Float values of estimated time for paths with minimum generalised cost flows
    • max_time - Float values of estimated time for paths with maximum generalised cost flows
    • min_gcost - Float values of estimated generalised cost for paths with minimum generalised cost flows
    • max_gcost - Float values of estimated generalised cost for paths with maximum generalised cost flows
    • industry_columns - All daily tonnages of industry columns given in the OD matrix data
  3. Shapefiles

    • edge_id - String/Integer/Float Edge ID
    • geometry - Shapely LineString geomtry of edges

Results

Csv sheets with results of failure analysis:

  1. All failure scenarios

    • edge_id - String name or list of failed edges
    • origin - String node ID of Origin of disrupted OD flow
    • destination - String node ID of Destination of disrupted OD flow
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_distance - Float value of estimated distance of OD journey before disruption
    • min/max_time - Float value of estimated time of OD journey before disruption
    • min/max_gcost - Float value of estimated travel cost of OD journey before disruption
    • new_cost - Float value of estimated cost of OD journey after disruption
    • new_distance - Float value of estimated distance of OD journey after disruption
    • new_path - List of string edge ID’s of estimated new route of OD journey after disruption
    • new_time - Float value of estimated time of OD journey after disruption
    • dist_diff - Float value of Post disruption minus per-disruption distance
    • time_diff - Float value Post disruption minus per-disruption timee
    • min/max_tr_loss - Float value of estimated change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
  2. Isolated OD scenarios - OD flows with no rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • industry_columns - Float values of all daily tonnages of industry columns along disrupted OD pairs
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  3. Rerouting scenarios - OD flows with rerouting options

    • edge_id - String name or list of failed edges
    • origin_province - String name of Province of Origin node ID of disrupted OD flow
    • destination_province - String name of Province of Destination node ID of disrupted OD flow
    • min/max_tr_loss - Float value of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages along disrupted OD pairs
  4. Min-max combined scenarios - Combined min-max results along each edge

    • edge_id - String name or list of failed edges
    • no_access - Boolean 1 (no reroutng) or 0 (rerouting)
    • min/max_tr_loss - Float values of change in rerouting cost
    • min/max_tons - Float values of total daily tonnages affted by disrupted edge
main()[source]

Estimate failures

Specify the paths from where you want to read and write:

  1. Input data
  2. Intermediate calcuations data
  3. Output results

Supply input data and parameters

  1. Names of modes
    String
  2. Names of min-max tons columns in sector data
    List of string types
  3. Min-max names of names of different types of attributes - paths, distance, time, cost, tons
    List of string types
  4. Names of commodity/industry columns for which min-max tonnage column names already exist
    List of string types
  5. Percentage of OD flows that are assumed disrupted
    List of float type
  6. Condition on whether analysis is single failure or multiple failure
    Boolean condition True or False

Give the paths to the input data files:

  1. Network edges csv and shapefiles
  2. OD flows csv file
  3. Failure scenarios csv file

Specify the output files and paths to be created

atra.analysis.risk_calculations module

Road network risks and adaptation maps

main()[source]