vtra.failure_scenario_selection package¶
Submodules¶
vtra.failure_scenario_selection.collect_network_hazard_scenarios_national module¶
Collect network hazard scenarios
-
main
()[source]¶ Process results
- Specify the paths from where you to read and write:
- Input data
- Intermediate calcuations data
- Output results
- 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
- 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
vtra.failure_scenario_selection.collect_network_hazard_scenarios_provincial module¶
Collect network hazard scenarios
-
main
()[source]¶ Process results
- Specify the paths from where you to read and write:
- Input data
- Intermediate calcuations data
- Output results
- 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
- 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
vtra.failure_scenario_selection.hazard_network_scenarios module¶
Utility functions for combined impact analysis
vtra.failure_scenario_selection.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¶
- Correct paths to all files and correct input parameters
- 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
- Shapefile of administrative boundaries of Vietnam 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
- 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¶
- 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, sector, hazard_files, hazard_df, bands, thresholds, commune_shape, network_type='', name_province='')[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:
-
main
()[source]¶ Collect results
- Specify the paths from where you to read and write:
- Input data
- Intermediate calcuations data
- Output results
- 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
- 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
vtra.failure_scenario_selection.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¶
- Correct paths to all files and correct input parameters
- 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
- Shapefile of hazards with attributes:
- geometry - Shapely geometry of hazard Polygon
Results¶
- 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
- 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_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
- Specify the paths from where you to read and write:
- Input data
- Intermediate calcuations data
- Output results
- Supply input data and parameters
- Names of the three Provinces - List of string types
- Paths of the mode files - List of tuples of strings
- Names of modes - List of strings
- Names of output modes - List of strings
- Condition ‘Yes’ or ‘No’ is the users wants to process results
- Give the paths to the input data files:
- Hazard directory
-
networkedge_hazard_intersection
(edge_shapefile, hazard_shapefile, output_shapefile)[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)[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