RA2CE Feature: adaptation measures#
+This notebook explains how users can create different adaptation options that will influence the calculated damages and losses on roads. It also performs a Cost-Benefit Analysis (CBA) for each of the adaptation option to explore the cost effectiveness of these options.
+[ ]:
+
from pathlib import Path
+from ra2ce.analysis.analysis_config_wrapper import AnalysisConfigWrapper
+from ra2ce.analysis.analysis_input_wrapper import AnalysisInputWrapper
+from ra2ce.ra2ce_handler import Ra2ceHandler
+from ra2ce.network.network_config_data.enums.aggregate_wl_enum import AggregateWlEnum
+from ra2ce.network.network_config_data.enums.source_enum import SourceEnum
+from ra2ce.analysis.analysis_config_data.analysis_config_data import (
+ AnalysisConfigData,
+ AnalysisSectionAdaptation,
+ AnalysisSectionAdaptationOption,
+ AnalysisSectionDamages,
+ AnalysisSectionLosses,
+)
+from ra2ce.analysis.analysis_config_data.enums.analysis_damages_enum import (
+ AnalysisDamagesEnum,
+)
+from ra2ce.analysis.analysis_config_data.enums.analysis_enum import AnalysisEnum
+from ra2ce.analysis.analysis_config_data.enums.analysis_losses_enum import (
+ AnalysisLossesEnum,
+)
+from ra2ce.analysis.analysis_config_data.enums.damage_curve_enum import DamageCurveEnum
+from ra2ce.analysis.analysis_config_data.enums.event_type_enum import EventTypeEnum
+from ra2ce.analysis.analysis_config_data.enums.traffic_period_enum import (
+ TrafficPeriodEnum,
+)
+from ra2ce.analysis.analysis_config_data.enums.trip_purpose_enum import TripPurposeEnum
+from ra2ce.analysis.analysis_config_data.enums.weighing_enum import WeighingEnum
+from ra2ce.analysis.analysis_config_wrapper import AnalysisConfigWrapper
+from ra2ce.analysis.analysis_input_wrapper import AnalysisInputWrapper
+from ra2ce.network.network_config_data.enums.aggregate_wl_enum import AggregateWlEnum
+from ra2ce.network.network_config_data.network_config_data import (
+ HazardSection,
+ NetworkConfigData,
+ NetworkSection,
+)
+from ra2ce.network.network_config_wrapper import NetworkConfigWrapper
+from ra2ce.analysis.adaptation.adaptation import Adaptation
+from ra2ce.analysis.analysis_config_wrapper import AnalysisConfigWrapper
+from ra2ce.analysis.analysis_input_wrapper import AnalysisInputWrapper
+
[ ]:
+
root_dir = Path("data", "adaptation")
+
+static_path = root_dir.joinpath("static")
+hazard_path =static_path.joinpath("hazard")
+network_path = static_path.joinpath("network")
+output_path=root_dir.joinpath("output")
+
+input_path = root_dir.joinpath("input") # path of the data files for all adaptation options and reference option
+
Network config#
+The network must first be configured and overlaid with a hazard map. The current workflow only supports the following configurations:
+-
+
AggregateWlENum: only MEAN
+SourceEnum must be set to SHAPEFILE. This is because we are running Losses which requires information about the traffic intensities,
+Adaptation is for now only event-based for a single hazard map. Therefore the name of the hazard map should not start with “RP” and should start the risk-based damage workflow will be triggered. The hazard name shoud start with a letter.
+
[ ]:
+
_network_section = NetworkSection(
+ source= SourceEnum.SHAPEFILE,
+ primary_file = [network_path.joinpath("network.shp")],
+ file_id = "ID",
+ link_type_column="highway",
+ save_gpkg=True
+)
+
+_hazard = HazardSection(
+ hazard_map=[Path(file) for file in hazard_path.glob("*.tif")],
+ hazard_field_name= ["waterdepth"],
+ aggregate_wl = AggregateWlEnum.MEAN,
+ hazard_crs = "EPSG:4326",
+)
+
+
+_network_config_data = NetworkConfigData(
+ root_path=root_dir,
+ static_path=static_path,
+ output_path=output_path,
+ network=_network_section,
+ hazard=_hazard
+ )
+
[ ]:
+
handler = Ra2ceHandler.from_config(_network_config_data, None)
+
+handler.configure()
+
Losses and Damages configuration#
+The configuration for the losses and damages analysis must be defined here. The general configurations of losses and damages are shared for all adaptation options! The only difference between the options are the input files used: resilience_curve.csv, traffic_intensities.csv, values_of_time.csv, damage_curves.csv and max_damage_road_type.csv
+For example, it is (currenlty) NOT possible for Adaptation option 1 to have production_loss_per_capita_per_hour=42
and for option 2: production_loss_per_capita_per_hour=20
Damages:#
+-
+
Since we are simulating the adaptation effects by modifying the hazard curves, only the Manual damage curve type is allowed:
DamageCurveEnum.MAN
+EventTypeEnum.EVENT
is mandatory since we are dealing with an event-base adaptation.
+
Losses:#
+-
+
Both single link and multi link losses are accepted:
AnalysisLossesEnum
+EventTypeEnum.EVENT
is mandatory since we are dealing with an event-base adaptation.
+All the other arguments can be modified
+
[ ]:
+
_damages_section = AnalysisSectionDamages(
+ analysis=AnalysisDamagesEnum.DAMAGES,
+ event_type=EventTypeEnum.EVENT,
+ damage_curve=DamageCurveEnum.MAN,
+ save_gpkg=True,
+ save_csv=True,
+ )
+
+ # - losses
+_multi_link_losses_section = AnalysisSectionLosses(
+ analysis=AnalysisLossesEnum.MULTI_LINK_LOSSES,
+ event_type=EventTypeEnum.EVENT,
+ weighing=WeighingEnum.TIME,
+ threshold=0,
+ production_loss_per_capita_per_hour=42,
+ hours_per_traffic_period=8,
+ traffic_period=TrafficPeriodEnum.DAY,
+ trip_purposes=[
+ TripPurposeEnum.BUSINESS,
+ TripPurposeEnum.COMMUTE,
+ TripPurposeEnum.FREIGHT,
+ TripPurposeEnum.OTHER,
+ ],
+ resilience_curves_file=input_path.joinpath("resilience_curve.csv"),
+ traffic_intensities_file=input_path.joinpath("traffic_intensities.csv"),
+ values_of_time_file=input_path.joinpath("values_of_time.csv"),
+ save_gpkg=True,
+ save_csv=True,
+ )
+
Adaptation options:#
+The adaptation options can now be defined.
+-
+
The
+AnalysisSectionAdaptation
must be filled with general inputs applicable to all adaptation options:-
+
type of losses analysis: single link or multi link
+discount rate: to account for inflation
+initial_frequency: this the frequency of occurence of the considered hazard map at year 0
+climate factor: accounting for the increase of likelihood over time fo the hazard map
+time horizon: numbers of years for the CBA
+
+A collection of adaptation options is to be specified:
+-
+
Each adaptation option has an
id
which must match the input data structure in order to assign the input files correctly
+The first adaptation option represents the initial situation (Business As Usual) and only requires a
name
andid
.
+The following adaptation options have extra required attributes to calculate the cost:
construction_cost
,construction_interval
, ‘maintenance_cost’, ‘maintenance_interval’
+
+
[ ]:
+
# - adaptation
+_adaptation_options = [
+ AnalysisSectionAdaptationOption(
+ id="AO0",
+ name="No adaptation",
+ ),
+ AnalysisSectionAdaptationOption(
+ id="AO1",
+ name="Cheap construction, expensive maintenance",
+ construction_cost=1000.0,
+ construction_interval=10.0,
+ maintenance_cost=200.0,
+ maintenance_interval=3.0,
+ ),
+ AnalysisSectionAdaptationOption(
+ id="AO2",
+ name="Expensive construction, cheap maintenance",
+ construction_cost=5000.0,
+ construction_interval=100.0,
+ maintenance_cost=50.0,
+ maintenance_interval=3.0,
+ ),
+]
+_adaptation_section = AnalysisSectionAdaptation(
+ analysis=AnalysisEnum.ADAPTATION,
+ losses_analysis=AnalysisLossesEnum.MULTI_LINK_LOSSES,
+ adaptation_options=_adaptation_options,
+ discount_rate=0.025, # correcting inflation 0.025 = 2.5%
+ initial_frequency=0.001, # yearly frequency of occurrence of the event (hazard map)
+ climate_factor=0.000235, # factor to correct for the positive increase of the frequency of occurrence of the event
+ time_horizon=20, # time horizon in years for the CBA analysis
+ )
+
+_analysis_config_data = AnalysisConfigData(
+ root_path=root_dir,
+ input_path=input_path,
+ static_path=static_path,
+ output_path=output_path,
+ analyses=[
+ _damages_section,
+ _multi_link_losses_section,
+ _adaptation_section,
+ ],
+ aggregate_wl=AggregateWlEnum.MEAN,
+ )
+
For this example. There are 2 adaptation options defined AO1
and AO2
, in addition to the reference case ‘AO0’. The corresponding files structure should then be the following (assuming MultiLinkLosses and damages based on all road types)
[ ]:
+
handler = Ra2ceHandler.from_config(_network_config_data, _analysis_config_data)
+
+handler.configure()
+handler.run_analysis()
+