ra2ce.analysis.adaptation package#
Submodules#
ra2ce.analysis.adaptation.adaptation module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class Adaptation(analysis_input, analysis_config)[source]#
Bases:
AnalysisBase
,AnalysisDamagesProtocol
Execute the adaptation analysis. For each adaptation option a damages and/or losses analysis is executed.
- Parameters:
analysis_input (AnalysisInputWrapper)
analysis_config (AnalysisConfigWrapper)
- property adaptation_options: list[AdaptationOption]#
-
all_options:
list
[AdaptationOption
]#
-
analysis:
AnalysisSectionAdaptation
#
- execute()[source]#
Run the adaptation analysis. This is done by calculating the impact of the reference option first. Then the BC-ratio of the adaptation options is calculated. The reference and option results are combined in a single result.
- Return type:
- Returns:
AnalysisResultWrapper: The result of the adaptation analysis.
-
graph_file_hazard:
NetworkFile
#
-
input_path:
Path
#
-
output_path:
Path
#
- property reference_option: AdaptationOption#
ra2ce.analysis.adaptation.adaptation_option module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AdaptationOption(id, name, construction_cost, construction_interval, maintenance_cost, maintenance_interval, analyses, analysis_config, adaptation_settings)[source]#
Bases:
object
- Parameters:
id (str)
name (str)
construction_cost (float)
construction_interval (float)
maintenance_cost (float)
maintenance_interval (float)
analyses (list[AdaptationOptionAnalysis])
analysis_config (AnalysisConfigWrapper)
adaptation_settings (AdaptationSettings)
-
adaptation_settings:
AdaptationSettings
#
-
analyses:
list
[AdaptationOptionAnalysis
]#
-
analysis_config:
AnalysisConfigWrapper
#
-
construction_cost:
float
#
-
construction_interval:
float
#
- classmethod from_config(analysis_config, adaptation_option)[source]#
Classmethod to create an AdaptationOption from an analysis configuration and an adaptation option.
- Return type:
- Parameters:
analysis_config (AnalysisConfigWrapper)
adaptation_option (AnalysisSectionAdaptationOption)
- Args:
analysis_config (AnalysisConfigWrapper): Analysis config input adaptation_option (AnalysisSectionAdaptationOption): Adaptation option input
- Raises:
ValueError: If damages and losses sections are not present in the analysis config data.
- Returns:
AdaptationOption: The created adaptation option.
- get_bc_ratio(reference_impact, gdf_in, hazard_fraction_cost)[source]#
Calculate the benefit-cost ratio of the adaptation option.
- Return type:
- Parameters:
reference_impact (AdaptationOptionPartialResult)
gdf_in (GeoDataFrame)
hazard_fraction_cost (bool)
- Args:
reference_impact (AdaptationOptionPartialResult): The impact of the reference option.
- Returns:
AdaptationOptionPartialResult: The benefit-cost ratio of the adaptation option.
- get_impact()[source]#
Calculate the impact of the adaptation option.
- Return type:
- Args:
net_present_value_factor (float): The net present value factor to apply to the event impact.
- Returns:
AdaptationOptionPartialResult: The impact (event and net) of the adaptation option per link.
-
id:
str
#
-
maintenance_cost:
float
#
-
maintenance_interval:
float
#
-
name:
str
#
ra2ce.analysis.adaptation.adaptation_option_analysis module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AdaptationOptionAnalysis(option_id, analysis_type, analysis_class, analysis_input, result_col)[source]#
Bases:
object
- Parameters:
option_id (str)
analysis_type (AnalysisDamagesEnum | AnalysisLossesEnum)
analysis_class (type[Damages | LossesBase])
analysis_input (AnalysisInputWrapper)
result_col (str)
-
analysis_class:
type
[Damages
|LossesBase
]#
-
analysis_input:
AnalysisInputWrapper
#
-
analysis_type:
AnalysisDamagesEnum
|AnalysisLossesEnum
#
- execute(analysis_config)[source]#
Execute the analysis.
- Return type:
- Parameters:
analysis_config (AnalysisConfigWrapper)
- Args:
analysis_config (AnalysisConfigWrapper): The config for the analysis.
- Returns:
AdaptationOptionPartialResult: The relevant result columns of the analysis.
- classmethod from_config(analysis_config, analysis_type, option_id)[source]#
Classmethod to create an AdaptationOptionAnalysis from an analysis configuration.
- Return type:
- Parameters:
analysis_config (AnalysisConfigWrapper)
analysis_type (AnalysisLossesEnum | AnalysisDamagesEnum)
option_id (str)
- Args:
analysis_config (AnalysisConfigWrapper): The analysis configuration. analysis_type (AnalysisLossesEnum | AnalysisDamagesEnum): The type of analysis. option_id (str): The ID of the adaptation option.
- Returns:
AdaptationOptionAnalysis: The created AdaptationOptionAnalysis.
- static get_analysis_info(analysis_type)[source]#
Get the analysis class and the result column for the given analysis.
- Return type:
tuple
[type
[Damages
|LossesBase
],str
]- Parameters:
analysis_type (AnalysisDamagesEnum | AnalysisLossesEnum)
- Args:
analysis (AnalysisDamagesEnum | AnalysisLossesEnum): The type of analysis.
- Raises:
NotImplementedError: The analysis type is not implemented.
- Returns:
tuple[type[Damages | LossesBase], str]: The analysis class and the regex to find the result column.
-
option_id:
str
#
-
result_col:
str
#
ra2ce.analysis.adaptation.adaptation_option_partial_result module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AdaptationOptionPartialResult(option_id, data_frame=<factory>, _id_col='rfid', _key_col='merge_key')[source]#
Bases:
object
Class to represent the partial result of an adaptation analysis. It wraps a GeoDataFrame with the results of the analysis and intermediate calculations.
- Parameters:
option_id (str)
data_frame (GeoDataFrame)
_id_col (str)
_key_col (str)
- add_column(col_type, column_data)[source]#
Add a data column to the result.
- Return type:
None
- Parameters:
col_type (AdaptationResultEnum | AnalysisDamagesEnum | AnalysisLossesEnum)
column_data (Series)
- Args:
col_type (AdaptationResultEnum | AnalysisDamagesEnum | AnalysisLossesEnum): The type of the column. column_data (Series): The data to add.
-
data_frame:
GeoDataFrame
#
- classmethod from_gdf_with_matched_col(option_id, gdf_in, regex, analysis_type)[source]#
Create a new object from a GeoDataFrame with a column matching a regex.
- Return type:
- Parameters:
option_id (str)
gdf_in (GeoDataFrame)
regex (str)
analysis_type (AnalysisDamagesEnum | AnalysisLossesEnum)
- Args:
option_id (str): The ID of the adaptation option. gdf_in (GeoDataFrame): The input GeoDataFrame. regex (str): The pattern to match. analysis_type (AnalysisDamagesEnum | AnalysisLossesEnum): The type of the input analysis.
- Returns:
AdaptationOptionPartialResult: The object with the matched column.
- classmethod from_input_gdf(option_id, gdf_in)[source]#
Create a new object from an input GeoDataFrame.
- Return type:
- Parameters:
option_id (str)
gdf_in (GeoDataFrame)
- Args:
gdf_in (GeoDataFrame): The input GeoDataFrame.
- Returns:
AdaptationOptionPartialResult: The object with the input data.
- get_column(col_type)[source]#
Get a data column from the result.
- Return type:
Series
- Parameters:
col_type (AdaptationResultEnum)
- Args:
col_type (AdaptationResultEnum): The type of the column.
- Returns:
Series: The data column.
-
option_id:
str
#
- property result_cols: list[str]#
- property standard_cols: list[str]#
ra2ce.analysis.adaptation.adaptation_result_enum module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
ra2ce.analysis.adaptation.adaptation_settings module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class AdaptationSettings(discount_rate=0.0, time_horizon=0.0, initial_frequency=0.0, climate_factor=0.0)[source]#
Bases:
object
- Parameters:
discount_rate (float)
time_horizon (float)
initial_frequency (float)
climate_factor (float)
-
climate_factor:
float
= 0.0#
-
discount_rate:
float
= 0.0#
-
initial_frequency:
float
= 0.0#
- property net_present_value_factor: float#
Calculate the net present value factor for the entire time horizon. To be multiplied to the event impact to obtain the net present value.
-
time_horizon:
float
= 0.0#