ra2ce.analysis.analysis_config_data package#
Enums#
- ra2ce.analysis.analysis_config_data.enums package
- Submodules
- ra2ce.analysis.analysis_config_data.enums.analysis_damages_enum module
- ra2ce.analysis.analysis_config_data.enums.analysis_enum module
- ra2ce.analysis.analysis_config_data.enums.analysis_losses_enum module
- ra2ce.analysis.analysis_config_data.enums.damage_curve_enum module
- ra2ce.analysis.analysis_config_data.enums.event_type_enum module
- ra2ce.analysis.analysis_config_data.enums.loss_type_enum module
- ra2ce.analysis.analysis_config_data.enums.risk_calculation_mode_enum module
- ra2ce.analysis.analysis_config_data.enums.traffic_period_enum module
- ra2ce.analysis.analysis_config_data.enums.trip_purpose_enum module
- ra2ce.analysis.analysis_config_data.enums.weighing_enum module
- Module contents
Classes#
- class ProjectSection(name='')[source]#
Bases:
object
Reflects all possible settings that a project section might contain.
- Parameters:
name (str)
- class AnalysisSectionBase(name='', save_gpkg=False, save_csv=False, analysis=<factory>)[source]#
Bases:
object
Reflects all common settings that damages and losses analysis sections might contain.
- Parameters:
name (str)
save_gpkg (bool)
save_csv (bool)
analysis (AnalysisEnum | AnalysisDamagesEnum | AnalysisLossesEnum)
-
analysis:
AnalysisEnum
|AnalysisDamagesEnum
|AnalysisLossesEnum
#
- class AnalysisSectionLosses(name='', save_gpkg=False, save_csv=False, analysis=<factory>, weighing=<factory>, production_loss_per_capita_per_hour=nan, traffic_period=<factory>, hours_per_traffic_period=0, trip_purposes=<factory>, resilience_curves_file=None, traffic_intensities_file=None, values_of_time_file=None, threshold=0.0, threshold_destinations=nan, equity_weight='', calculate_route_without_disruption=False, buffer_meters=nan, category_field_name='', save_traffic=False, event_type=<factory>, risk_calculation_mode=<factory>, risk_calculation_year=0)[source]#
Bases:
AnalysisSectionBase
Represents all configurable settings for a losses analysis section in RA2CE.
This class defines parameters for single link redundancy, accessibility, and risk/loss analyses, including weighing, traffic, thresholds, and output options.
- Parameters:
name (str)
save_gpkg (bool)
save_csv (bool)
analysis (AnalysisLossesEnum)
weighing (WeighingEnum)
production_loss_per_capita_per_hour (float | None)
traffic_period (TrafficPeriodEnum | None)
hours_per_traffic_period (int | None)
trip_purposes (list[TripPurposeEnum] | None)
resilience_curves_file (Path | None)
traffic_intensities_file (Path | None)
values_of_time_file (Path | None)
threshold (float | None)
threshold_destinations (float | None)
equity_weight (str | None)
calculate_route_without_disruption (bool | None)
buffer_meters (float | None)
category_field_name (str | None)
save_traffic (bool | None)
event_type (EventTypeEnum | None)
risk_calculation_mode (RiskCalculationModeEnum | None)
risk_calculation_year (int | None)
- analysis#
Specifies the type of losses/criticality analysis to perform.
- weighing#
Defines the weighing method for the analysis (e.g., length, travel time).
- production_loss_per_capita_per_hour#
Economic loss per capita per hour, if applicable. Required only for losses analysis type.
- traffic_period#
Traffic period for the analysis (e.g., day, peak). Required only for losses analysis type.
- hours_per_traffic_period#
Number of hours corresponding to the selected traffic period. Required only for losses analysis type.
- trip_purposes#
Trip purposes to include in the analysis. Required only for losses analysis type.
- resilience_curves_file#
Path to a file containing resilience curves for losses analysis. Required only for losses analysis type.
- traffic_intensities_file#
Path to a file containing the traffic intensities information. Required only for losses analysis type.
- values_of_time_file#
Path to a file containing value-of-time data. Required only for losses analysis type.
- threshold#
Threshold value used for redundancy or accessibility analyses (e.g., maximum tolerable disruption).
- threshold_destinations#
Threshold specifically for destination accessibility.
- equity_weight#
Field name or identifier to apply equity weighting in the analysis.
- calculate_route_without_disruption#
If True, calculates baseline routes without any disruptions for comparison.
- buffer_meters#
Buffer distance in meters to consider around network elements, e.g., for exposure or accessibility.
- category_field_name#
Field name used to categorize links or nodes in the analysis.
- save_traffic#
If True, saves intermediate traffic results during the analysis.
- event_type#
Specifies the type of event or hazard for risk/loss calculations.
- Type:
EventTypeEnum
- risk_calculation_mode#
Defines the mode of risk calculation (e.g., expected annual loss, scenario-based).
- risk_calculation_year#
Year used for risk or estimated annual loss calculations.
- class AnalysisSectionDamages(name='', save_gpkg=False, save_csv=False, analysis=<factory>, representative_damage_percentage=100, event_type=<factory>, damage_curve=<factory>, risk_calculation_mode=<factory>, risk_calculation_year=0, create_table=False, file_name=None)[source]#
Bases:
AnalysisSectionBase
Configuration for a damages analysis section.
This dataclass reflects all possible settings for performing a damages-related analysis. It defines parameters for how road damages, risks, and associated outputs should be calculated and represented.
- Parameters:
name (str)
save_gpkg (bool)
save_csv (bool)
analysis (AnalysisDamagesEnum)
representative_damage_percentage (float | None)
event_type (EventTypeEnum)
damage_curve (DamageCurveEnum)
risk_calculation_mode (RiskCalculationModeEnum)
risk_calculation_year (int | None)
create_table (bool | None)
file_name (Path | None)
- analysis#
Type of damages analysis to perform. Defaults to
AnalysisDamagesEnum.INVALID
.- Type:
AnalysisDamagesEnum
- representative_damage_percentage#
Percentage of representative damage to apply in the analysis (default is 100).
- Type:
float
, optional
- event_type#
Choose if the damages must be calculated from an event perspective (
EventTypeEnum.EVENT
) or a risk perspective (EventTypeEnum.RETURN_PERIOD
). Defaults toEventTypeEnum.NONE
.- Type:
EventTypeEnum
- damage_curve#
Type of damage curves to be used: Huizinga (
DamageCurveEnum.HZ
), OSD (DamageCurveEnum.OSD
), or manual (DamageCurveEnum.MAN
). Defaults toDamageCurveEnum.INVALID
.- Type:
DamageCurveEnum
- risk_calculation_mode#
Mode used for risk calculation (e.g., deterministic, probabilistic). Defaults to
RiskCalculationModeEnum.NONE
.- Type:
RiskCalculationModeEnum
, optional
- risk_calculation_year#
Year used for risk calculation scenarios. Required if risk_calculation_mode is set to
RiskCalculationModeEnum.TRIANGLE_TO_NULL_YEAR
Defaults to 0 (unspecified).- Type:
int
, optional
- create_table#
- Type:
bool
, optional
- file_name#
- Type:
Path
orNone
Notes
This section is typically part of a larger analysis pipeline and defines only the configuration parameters, not the computational logic.
- class AnalysisSectionAdaptation(name='', save_gpkg=False, save_csv=False, analysis=AnalysisEnum.ADAPTATION, losses_analysis=AnalysisLossesEnum.SINGLE_LINK_LOSSES, time_horizon=0.0, discount_rate=0.0, initial_frequency=0.0, climate_factor=0.0, hazard_fraction_cost=False, adaptation_options=<factory>)[source]#
Bases:
AnalysisSectionBase
Reflects all possible settings that an adaptation analysis section might contain.
- Parameters:
name (str)
save_gpkg (bool)
save_csv (bool)
analysis (AnalysisEnum)
losses_analysis (AnalysisLossesEnum)
time_horizon (float)
discount_rate (float)
initial_frequency (float)
climate_factor (float)
hazard_fraction_cost (bool)
adaptation_options (list[AnalysisSectionAdaptationOption])
- class AnalysisSectionAdaptationOption(id='', name='', construction_cost=0.0, construction_interval=1000.0, maintenance_cost=0.0, maintenance_interval=1000.0)[source]#
Bases:
object
Reflects all possible settings that an adaptation option might contain. The id should be unique and is used to determine the location of the input and output files.
- Parameters:
id (str)
name (str)
construction_cost (float)
construction_interval (float)
maintenance_cost (float)
maintenance_interval (float)
- class AnalysisConfigData(root_path=None, input_path=None, output_path=None, static_path=None, project=<factory>, analyses=<factory>, origins_destinations=<factory>, network=<factory>, aggregate_wl=<factory>)[source]#
Bases:
ConfigDataProtocol
Represents all configuration data for analyses in RA2CE, including defaults from analysis.ini.
This class consolidates analysis configuration settings and integrates relevant network attributes (e.g., network, origins/destinations, hazard names) for convenience.
- Parameters:
root_path (Path | None)
input_path (Path | None)
output_path (Path | None)
static_path (Path | None)
project (ProjectSection)
analyses (list[AnalysisSectionDamages | AnalysisSectionLosses | AnalysisSectionAdaptation])
origins_destinations (OriginsDestinationsSection | None)
network (NetworkSection)
aggregate_wl (AggregateWlEnum)
- ANALYSIS_SECTION#
Union type for analysis sections (damages, losses, adaptation).
- root_path#
Root directory path for the project.
- input_path#
Input directory path for the project.
- output_path#
Output directory path where results will be saved.
- static_path#
Path to static project files.
- project#
Section containing project metadata.
- analyses#
List of all analysis to run consecutively.
- origins_destinations#
Section containing origins and destinations data.
- network#
Section containing network configuration data.
- ANALYSIS_SECTION = ra2ce.analysis.analysis_config_data.analysis_config_data.AnalysisSectionDamages | ra2ce.analysis.analysis_config_data.analysis_config_data.AnalysisSectionLosses | ra2ce.analysis.analysis_config_data.analysis_config_data.AnalysisSectionAdaptation | ra2ce.analysis.analysis_config_data.analysis_config_data_protocol.AnalysisConfigDataProtocol#
- property adaptation: AnalysisSectionAdaptation | None#
Get the adaptation analysis from config.
- Returns:
AnalysisSectionAdaptation: Adaptation analysis.
- property damages_list: list[AnalysisSectionDamages]#
Get all damages analyses from config.
- Returns:
list[AnalysisSectionDamages]: List of all damages analyses.
- get_analysis(analysis)[source]#
Get a certain analysis from config.
- Return type:
ANALYSIS_SECTION | None
- Parameters:
analysis (AnalysisEnum | AnalysisDamagesEnum | AnalysisLossesEnum)
- Returns:
- AnalysisSectionLosses | AnalysisSectionDamages | AnalysisSectionAdaptation:
The analysis.
- property losses_list: list[AnalysisSectionLosses]#
Get all losses analyses from config.
- Returns:
list[AnalysisSectionLosses]: List of all losses analyses.
- reroot_analysis_config(analysis_type, new_root)[source]#
Reroot dependent analysis in config data to the input of another analysis.
- Return type:
- Parameters:
analysis_type (AnalysisDamagesEnum | AnalysisLossesEnum)
new_root (Path)
- Returns:
AnalysisConfigData: The rerooted config data.