Skip to main content
Ctrl+K

RA2CE

  • Overview
  • Installation
  • Examples
  • Contributing
  • Technical Documentation
    • Changelog
  • GitHub
  • Deltares
  • Overview
  • Installation
  • Examples
  • Contributing
  • Technical Documentation
  • Changelog
  • GitHub
  • Deltares

Section Navigation

Table of Contents

  • RA2CE
  • Installation
  • Examples
    • Basic examples
      • RA2CE basics: set up RA2CE and configure a road network
      • RA2CE feature: Equity analysis
      • RA2CE feature: single link redundancy without the example data
      • RA2CE feature: Single link losses analysis
      • RA2CE feature: Multi-link losses analysis
      • RA2CE feature: Origin-destination analysis
      • RA2CE feature: Damages analysis (Huizinga)
      • RA2CE feature: Damages analysis (manual)
      • RA2CE feature: Damages analysis (OSdaMage)
      • RA2CE feature: Hazard overlay
      • RA2CE feature: Isolated locations
      • RA2CE feature: Optimal routes between origins and destinations
      • RA2CE basics: set up RA2CE and configure a road network from a pre-defined shapefile
      • Download a Network using a polygon
      • RA2CE basics: setting up an origin-destination analysis
      • RA2CE: Do It Yourself
    • Hackathon sessions
      • Hackathon Q1 - 2024
    • Technical meetings
      • Tech Meeting 2024 Q1 - Run with(out) ini files
      • Tech Meeting 2024 Q1 - Enumerations
  • Network Module
  • Analysis module
  • Contributing
    • Design principles
    • Implementation decisions
  • Technical Documentation
    • Network
    • Analysis
  • Frequently Asked Questions
  • Publications
  • Overview
  • Examples
  • Basic examples
  • RA2CE feature: Single link losses analysis

RA2CE feature: Single link losses analysis#

Single link losses Analysis#

[ ]:
from pathlib import Path
from ra2ce.ra2ce_handler import Ra2ceHandler
import geopandas as gpd
import pyproj

# Import config data
root_dir = Path("data", "single_link_losses")
assert root_dir.exists()

# Load network data.
from ra2ce.network.network_config_data.network_config_data_reader import NetworkConfigDataReader
_network_config_data = NetworkConfigDataReader().read(root_dir.joinpath("network.ini"))

# Load analysis data.
from ra2ce.analysis.analysis_config_data.analysis_config_data_reader import AnalysisConfigDataReader
_analysis_config_data = AnalysisConfigDataReader().read(root_dir.joinpath("analysis.ini"))

Modify the analysis config data with custom properties#

[2]:
from ra2ce.analysis.analysis_config_data.analysis_config_data import AnalysisSectionLosses

# Modify the first analysis (assuming it's the only one)
_found_analysis: AnalysisSectionLosses = _analysis_config_data.analyses[0]
_input_analysis_path = root_dir.joinpath("input_analysis_data")
_found_analysis.traffic_intensities_file = _input_analysis_path.joinpath("traffic_intensities.csv")
_found_analysis.resilience_curves_file = _input_analysis_path.joinpath("resilience_curve.csv")
_found_analysis.values_of_time_file = _input_analysis_path.joinpath("values_of_time.csv")

Configure network#

Let’s have a look first at the hazard overlay to locate the road segments for which losses will be expected. We run only the network configuration.

[3]:
handler = Ra2ceHandler.from_config(_network_config_data, _analysis_config_data)
handler.configure()
[ ]:
hazard_output = root_dir / "static" / "output_graph" / "base_graph_hazard_edges.gpkg"
hazard_gdf = gpd.read_file(hazard_output, driver = "GPKG")
hazard_gdf.crs = pyproj.CRS(4326)
hazard_gdf.explore(column="EV1_ma", cmap = "viridis", tiles="CartoDB positron")

Run losses analysis#

[ ]:
handler.run_analysis()

Let’s inspect the results of the analysis. For every segment in the network, the losses are expressed in vehicle loss hour (vlh) for all the types of trip defined in the input files: business, commute, freight and other.

[ ]:
analysis_output_folder = root_dir / "output" / "single_link_losses" # specify path to output folder

losses_gdf = gpd.read_file(analysis_output_folder/"beira_single_losses.gpkg") #specify the name of the geopackage holding your results (can be found in the analysis output folder)
losses_gdf.head() #display the attributes of the file

The map below displays the total loss for all trip types per link

[ ]:
losses_roads_map = losses_gdf.explore(column='vlh_EV1_ma_total', tiles="CartoDB positron",)
display(losses_roads_map)

previous

RA2CE feature: single link redundancy without the example data

next

RA2CE feature: Multi-link losses analysis

On this page
  • Single link losses Analysis
    • Modify the analysis config data with custom properties
    • Configure network
    • Run losses analysis
Edit on GitHub
Show Source

© Copyright 2024, Deltares.

Created using Sphinx 6.2.1.

Built with the PyData Sphinx Theme 0.16.0.