climada.trajectories.static_trajectory module#
- class climada.trajectories.static_trajectory.StaticRiskTrajectory(snapshots_list: Iterable[Snapshot], *, return_periods: Iterable[int] = (20, 50, 100), risk_disc_rates: DiscRates | None = None, impact_computation_strategy: ImpactComputationStrategy | None = None)[source]#
Bases:
RiskTrajectoryThis class implements static risk trajectories: objects that regroup impacts computations for multiple dates.
This class computes risk metrics over a series of Snapshot objects, optionally applying risk discounting, and offers access to the results in tidy formatted pandas DataFrames.
Contrary to InterpolatedRiskTrajectories, it does not interpolate risk between the snapshot and only provides results at each snapshot specific date.
- POSSIBLE_METRICS = ['eai', 'aai', 'return_periods', 'aai_per_group']#
Class variable listing the risk metrics that can be computed.
Currently:
eai, expected impact (per exposure point within a period of 1/frequency
unit of the hazard object) - aai, average annual impact (aggregated eai over the whole exposure) - aai_per_group, average annual impact per exposure subgroup (defined from the exposure geodataframe) - return_periods, estimated impacts aggregated over the whole exposure for different return periods
- __init__(snapshots_list: Iterable[Snapshot], *, return_periods: Iterable[int] = (20, 50, 100), risk_disc_rates: DiscRates | None = None, impact_computation_strategy: ImpactComputationStrategy | None = None)[source]#
Initialize a new StaticRiskTrajectory.
- Parameters:
snapshots_list (list[Snapshot]) – The list of Snapshot object to compute risk from.
return_periods (list[int], optional) – The return periods to use when computing the return_periods_metric. Defaults to DEFAULT_RP ([20, 50, 100]).
risk_disc_rates (DiscRates, optional) – The discount rate to apply to future risk. Defaults to None.
impact_computation_strategy (ImpactComputationStrategy, optional) – The method used to calculate the impact from the (Haz,Exp,Vul) for each snapshot. Defaults to
ImpactCalcComputation.
- property impact_computation_strategy: ImpactComputationStrategy#
The approach or strategy used to calculate the impact from the snapshots.
- eai_metrics(**kwargs) DataFrame[source]#
Return the estimated annual impacts at each exposure point for each date.
This method computes and return a DataFrame with eai metric (for each exposure point) for each date.
Notes
This computation may become quite expensive for exposures with many points (e.g., big areas with high resolution).
- aai_metrics(**kwargs) DataFrame[source]#
Return the average annual impacts for each date.
This method computes and return a DataFrame with aai metric for each date.
- return_periods_metrics(**kwargs) DataFrame[source]#
Return the estimated impacts for different return periods.
Return periods to estimate impacts for are defined by self.return_periods.
- aai_per_group_metrics(**kwargs) DataFrame[source]#
Return the average annual impacts for each exposure group ID.
This method computes and return a DataFrame with aai metric for each of the exposure group defined by a group id, for each date.
- per_date_risk_metrics(metrics: list[str] | None = None) DataFrame | Series[source]#
Returns a DataFrame of risk metrics for each dates.
This methods collects (and if needed computes) the metrics (Defaulting to AAI_METRIC_NAME, RETURN_PERIOD_METRIC_NAME and AAI_PER_GROUP_METRIC_NAME).
- Parameters:
metrics (list[str], optional) – The list of metrics to return (defaults to [AAI_METRIC_NAME,RETURN_PERIOD_METRIC_NAME,AAI_PER_GROUP_METRIC_NAME])
- Returns:
A tidy DataFrame with metric values for all possible dates.
- Return type:
pd.DataFrame | pd.Series
climada.trajectories.trajectory module#
- class climada.trajectories.trajectory.RiskTrajectory(snapshots_list: Iterable[Snapshot], *, return_periods: Iterable[int] = (20, 50, 100), all_groups_name: str = 'All', risk_disc_rates: DiscRates | None = None)[source]#
Bases:
ABCBase abstract class for risk trajectory objects.
See concrete implementation
StaticRiskTrajectoryandInterpolatedRiskTrajectoryfor more details.- POSSIBLE_METRICS = []#
Class variable listing the risk metrics that can be computed.
- __init__(snapshots_list: Iterable[Snapshot], *, return_periods: Iterable[int] = (20, 50, 100), all_groups_name: str = 'All', risk_disc_rates: DiscRates | None = None)[source]#
- property return_periods: Iterable[int]#
The return period values to use when computing risk period metrics.
Notes
Changing its value resets the corresponding metric.
- property risk_disc_rates: DiscRates | None#
The discount rate applied to compute net present values. None means no discount rate.
Notes
Changing its value resets all the metrics.
- classmethod npv_transform(metric_df: DataFrame, risk_disc_rates: DiscRates) DataFrame[source]#
Apply provided discount rate to the provided metric DataFrame.
- Parameters:
metric_df (pd.DataFrame) – The DataFrame of the metric to discount.
risk_disc_rates (DiscRate) – The discount rate to apply.
- Returns:
The discounted risk metric.
- Return type:
pd.DataFrame