ra2ce.analysis.damages.damage_calculation package#
Submodules#
ra2ce.analysis.damages.damage_calculation.damage_network_base 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 DamageNetworkBase(road_gdf, val_cols, representative_damage_percentage)[source]#
Bases:
ABC
A road network gdf with hazard data stored in it, and for which damages can be calculated
- Parameters:
road_gdf (GeoDataFrame)
val_cols (list[str])
representative_damage_percentage (float)
- calculate_damage_HZ(events)[source]#
- Return type:
None
- Parameters:
events (list[str])
- Arguments:
events (list) = list of events (or return periods) to iterate over, these should match the hazard column names
- calculate_damage_OSdaMage(events)[source]#
Damage calculation with the OSdaMage functions
- Return type:
None
- Parameters:
events (list[str])
- calculate_damage_manual_functions(events, manual_damage_functions)[source]#
Calculate the damage using the manual damage functions
- Return type:
None
- Parameters:
events (list[str])
manual_damage_functions (ManualDamageFunctions)
- Args:
events (list[str]): list of events (or return periods) to iterate over, these should match the hazard column names manual_damage_functions (ManualDamageFunctions): The manual damage functions object
- create_mask()[source]#
#Create a mask of only the dataframes with hazard data (to speed-up damage calculations) effect: self._gdf_mask = mask of only the rows with hazard data
- Return type:
None
- do_cleanup_and_mask_creation()[source]#
Call all cleanup and mask functions, because this is a standard procedure in most calculations
- abstractmethod main(damage_function, manual_damage_functions)[source]#
Controller for doing the EAD calculation
- Args:
damage_function (DamageCurveEnum): damage function key name that is to be used manual_damage_functions (ManualDamageFunctions): ManualDamageFunctions object
- Parameters:
damage_function (DamageCurveEnum)
manual_damage_functions (ManualDamageFunctions)
- remap_road_types_to_fewer_classes()[source]#
Creates a new new column road_types, which has a fewer number of road type categories e.g. -> ‘motorway_junction’ -> ‘motorway’ (Renames highway column to infra_type) :return:
ra2ce.analysis.damages.damage_calculation.damage_network_events 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 DamageNetworkEvents(road_gdf, val_cols, representative_damage_percentage)[source]#
Bases:
DamageNetworkBase
A road network gdf with EVENT-BASED hazard data stored in it, and for which damages can be calculated
@Author: Kees van Ginkel
- Mandatory attributes:
self.events (set) : all available unique events self.stats (set) : the available statistics
- Parameters:
road_gdf (GeoDataFrame)
val_cols (list[str])
representative_damage_percentage (float)
- main(damage_function, manual_damage_functions=None)[source]#
Controller for doing the EAD calculation
- Args:
damage_function (DamageCurveEnum): damage function key name that is to be used manual_damage_functions (ManualDamageFunctions): ManualDamageFunctions object
- Parameters:
damage_function (DamageCurveEnum)
ra2ce.analysis.damages.damage_calculation.damage_network_return_periods 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 DamageNetworkReturnPeriods(road_gdf, val_cols, representative_damage_percentage)[source]#
Bases:
DamageNetworkBase
A road network gdf with Return-Period based hazard data stored in it, and for which damages and risk can be calculated @Author: Kees van Ginkel
- Mandatory attributes:
self.return_periods (set of strings): ‘e.g self.stats (set) : the available statistics
- Parameters:
road_gdf (GeoDataFrame)
val_cols (list[str])
representative_damage_percentage (float)
- classmethod construct_from_csv(csv_path, representative_damage_percentage, sep)[source]#
- Parameters:
csv_path (Path)
representative_damage_percentage (float)
sep (str)
- control_risk_calculation(damage_function, mode, year)[source]#
Controller for the risk calculation, which calls the appropriate risk (integration) functions.
- Args:
damage_function: Defines the damage estimation method. mode: The type of risk calculation to perform. Can be ‘default’,
‘cut_from_YYYY_year’, or ‘triangle_to_null_YYYY_year’.
year: The cutoff year or return period of the risk calculation.
- Returns:
None
- Parameters:
damage_function (DamageCurveEnum)
mode (RiskCalculationModeEnum)
year (int)
- static integrate_df_trapezoidal(df)[source]#
- Return type:
array
- Parameters:
df (DataFrame)
- Arguments:
- df (pd.DataFrame) :
Column names should contain return periods (years) Each row should contain a set of damages for one object
- Returns:
np.array : integrated result per row
- main(damage_function, manual_damage_functions)[source]#
Control the damage calculation per return period
- Parameters:
damage_function (DamageCurveEnum)
- static rework_damage_data_cut_from(to_integrate, cutoff_rp)[source]#
Rework the damage data to make it suitable for integration (risk calculation) in default mode
- Parameters:
_to_integrate – _cutoff_rp : the return period at which to make the cutoff, aka the flood protection level
to_integrate (DataFrame)
cutoff_rp (int)
- Return type:
DataFrame
- Returns:
_to_integrate
- static rework_damage_data_default(to_integrate)[source]#
Rework the damage data to make it suitable for integration (risk calculation) in default mode
- Parameters:
_to_integrate
to_integrate (DataFrame)
- Return type:
DataFrame
- Returns:
_to_integrate
- static rework_damage_data_triangle_to_null(to_integrate, triangle_end)[source]#
Rework the damage data to make it suitable for integration (risk calculation) in default mode
- Parameters:
_to_integrate – _triangle_end_rp : the return period at to end the triangle
to_integrate (DataFrame)
triangle_end (float)
- Return type:
DataFrame
- Returns:
_to_integrate
ra2ce.analysis.damages.damage_calculation.risk_utils 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/>.