climada_petals.engine.cat_bonds package#
climada_petals.engine.cat_bonds.helpers_tutorial_cat_bonds module#
- climada_petals.engine.cat_bonds.helpers_tutorial_cat_bonds.create_earthquake_mmi_impact_function(impf_id=1, haz_type='EQ')[source]#
Create a stylized earthquake impact function for MMI-based hazards.
The curve uses separate smooth transitions for the affected asset share (PAA) and the mean damage degree conditional on being affected (MDD).
- Parameters:
impf_id (int, optional) – Impact function identifier.
haz_type (str, optional) – Hazard type associated with the impact function.
- Returns:
Impact function set containing a single MMI-based impact function.
- Return type:
ImpactFuncSet
- climada_petals.engine.cat_bonds.helpers_tutorial_cat_bonds.remap_event_years_even(hazard, start_year=1980, n_years=1000)[source]#
This function is intended for tropical cyclone data sets based on STORM which can be downloaded from the CLIMADA data API. In these data sets, all events are assigned the same year which is not suitable for CAT bond simulations that rely on the distribution of events over time. This function remaps the event years to be evenly distributed over a specified number of years while preserving the original month/day seasonality of the events.
climada_petals.engine.cat_bonds.mlt_bond_simulation module#
climada_petals.engine.cat_bonds.pooling_functions module#
climada_petals.engine.cat_bonds.sng_bond_simulation module#
- class climada_petals.engine.cat_bonds.sng_bond_simulation.SingleCountryBondSimulation(subarea_calc, term: int, start_year: int, number_of_terms: int)[source]#
Bases:
objectSingle-country catastrophe bond simulation utilities.
This class simulates losses and returns for a single country’s bond based on per-event payouts and damages.
- __init__(subarea_calc, term: int, start_year: int, number_of_terms: int)[source]#
Initialize with subarea data and simulation horizon.
- Parameters:
subarea_calc (object) – Subarea calculation instance.
term (int) – Bond term in years for each simulated period.
start_year (int) – The starting year of the simulation.
number_of_terms (int) – Number of consecutive terms to simulate.
- init_bond_loss(events_per_year: list[DataFrame])[source]#
Calculates the expected losses for a catastrophe bond over its term. This function simulates the bond’s loss experience given a sequence of event data per year and month, tracking payouts, damages, remaining princpal value, and the timing of losses. It returns the relative losses, the total payouts and damages per term, and a DataFrame detailing losses and their corresponding months.
- Parameters:
events_per_year (list[pandas.DataFrame]) – A list where each element is a DataFrame representing events in a year. Each DataFrame must contain at least ‘month’ and ‘pay’ columns, where ‘pay’ is the payout for each event.
- Returns:
rel_annual_losses (numpy.ndarray) – Array of relative payouts/losses per year (losses divided by principal).
rel_monthly_loss (pandas.DataFrame) – DataFrame with columns ‘losses’ and ‘months’, detailing the losses and their corresponding months for each year.
summed_payouts (float) – The total summed payouts over the bond’s term.
summed_damages (float) – The total summed damages over the bond’s term.
- init_loss_simulation(confidence_levels: list[float] = [0.95, 0.99])[source]#
Simulate losses, payouts, damages, and risk metrics for a catastrophe bond.
- Parameters:
confidence_levels (list[float], optional) – Confidence levels for VaR and ES calculation.
Sets
——-
df_loss_month (pd.DataFrame) – Monthly loss data for all simulations.
loss_metrics (dict) – Expected loss, attachment probability, total payouts/damages, VaR and ES metrics for given confidence levels.
- init_return_simulation(premium: float)[source]#
Simulates the performance of a catastrophe bond over the simulation period, premiums and returns. This function models the bond’s payouts, premiums, and returns over a series of simulated years. It aggregates annual and total returns and computes Sharpe ratios.
- Parameters:
premium (float) – Annual premium rate for the bond.
- Returns:
return_metrics – Dictionary with annual premiums, annual returns, total returns, total premiums, and Sharpe ratio.
- Return type:
dict
climada_petals.engine.cat_bonds.subareas module#
- class climada_petals.engine.cat_bonds.subareas.Subareas(hazard, vulnerability, exposure, subareas_gdf: GeoDataFrame)[source]#
Bases:
objectHandle subareas for CAT bond spatial aggregation.
- Parameters:
hazard (climada.Hazard) – Hazard object containing event data. Attention: The date attribute is used in the CAT bond simulation. Date must include a year and month.
vulnerability (climada.Vulnerability) – Vulnerability object containing vulnerability functions.
exposure (climada.Exposure) – Exposure object containing monetary data and geometry.
subareas_gdf (geopandas.GeoDataFrame) – GeoDataFrame containing subarea polygons. Must cover the exposure perimeter and include (or will be assigned) a subarea_letter column.
- hazard#
Hazard object containing event data. Attention: The date attribute is used in the CAT bond simulation. Date must include a year and month.
- Type:
climada.Hazard
- vulnerability#
Vulnerability object containing vulnerability functions.
- Type:
climada.Vulnerability
- exposure#
Exposure object containing monetary data and geometry.
- Type:
climada.Exposure
- subareas_gdf#
GeoDataFrame of subarea polygons with subarea_letter labels.
- Type:
geopandas.GeoDataFrame
- __init__(hazard, vulnerability, exposure, subareas_gdf: GeoDataFrame)[source]#
Initialize a Subareas instance.
- Parameters:
hazard (climada.Hazard) – Hazard object containing event data. Attention: The date attribute is used
in the CAT bond simulation. Date must include a year and month.
vulnerability (climada.Vulnerability) – Vulnerability object containing vulnerability functions.
exposure (climada.Exposure) – Exposure object containing monetary data and geometry.
subareas_gdf (geopandas.GeoDataFrame) – GeoDataFrame containing subarea polygons.
- classmethod from_resolution(hazard, vulnerability, exposure, resolution: float, subareas_gdf: GeoDataFrame | None = None)[source]#
Create subareas from a grid resolution and an exposure layer.
- Parameters:
hazard (climada.Hazard) – Hazard object containing event data. Attention: The date attribute is used
in the CAT bond simulation. Date must include a year and month.
vulnerability (climada.Vulnerability) – Vulnerability object containing vulnerability functions.
exposure (climada.Exposure) – Exposure object containing monetary data and geometry.
resolution (float) – Grid cell size used to generate subareas.
subareas_gdf (geopandas.GeoDataFrame, optional) – Unused placeholder for compatibility.
- Returns:
Initialized instance with generated subareas.
- Return type:
- classmethod from_geodataframe(hazard, vulnerability, exposure, gdf: GeoDataFrame)[source]#
Create subareas from an existing GeoDataFrame.
- Parameters:
hazard (climada.Hazard) – Hazard object containing event data. Attention: The date attribute is used
in the CAT bond simulation. Date must include a year and month.
vulnerability (climada.Vulnerability) – Vulnerability object containing vulnerability functions.
exposure (climada.Exposure) – Exposure object containing monetary data and geometry.
gdf (geopandas.GeoDataFrame) – GeoDataFrame of polygon subareas covering the exposure perimeter.
- Returns:
Initialized instance with the provided subareas.
- Return type:
- property exposure#
Return the exposure object.
- Returns:
Exposure object containing monetary data and geometry.
- Return type:
climada.Exposure
climada_petals.engine.cat_bonds.subarea_calculations module#
- class climada_petals.engine.cat_bonds.subarea_calculations.SubareaCalculations(subareas, index_stat: float | str, initial_guess: tuple[float, float] | None = None)[source]#
Bases:
objectSubarea-level calculations for parametric catastrophe bond payout setup.
This class computes impacts, parametric indices, payout thresholds, and pay-versus-damage tables for a set of subareas.
- Parameters:
subareas (object) – Container with exposure, hazard, vulnerability, and subareas_gdf.
index_stat (str or float) – Statistic for the parametric index (e.g., “mean” or a percentile).
intitial_guess (tuple[float, float], optional) – Initial guess for minimum and maximum payout trigger thresholds.
- subareas#
Input container holding exposure, hazard, vulnerability, and subareas.
- Type:
object
- index_stat#
Statistic used to summarize hazard intensity per subarea which is used as parametric index.
- Type:
str or float
- initial_guess#
Initial guess for minimum/maximum thresholds for the payout function.
- Type:
tuple[float, float]
- __init__(subareas, index_stat: float | str, initial_guess: tuple[float, float] | None = None)[source]#
Initialize the subarea calculation helper.
- Parameters:
subareas (object) – Container with exposure, hazard, vulnerability, and subareas_gdf.
index_stat (str or float) – Statistic used for the parametric index (“mean” or a percentile).
initial_guess (tuple[float, float], optional) – Initial guess for min/max payout trigger thresholds. When omitted, the 30th and 60th percentiles of hazard intensity are used.
- create_pay_vs_dam(attachment_point: float, exhaustion_point: float, methods_attachment_point: str | None = None, methods_exhaustion_point: str | None = None)[source]#
Build the pay-versus-damage table for the bond structure.
This runs impact calculation, parametric index creation, payout calibration, and computes pay/damage per event.
- Parameters:
attachment_point (float) – Attachment point value or parameter for the selected method. Is either a monetary amount, a fraction of total exposure, or a return period in years.
exhaustion_point (float) – Exhaustion point value or parameter for the selected method. Is either a monetary amount, a fraction of total exposure, or a return period in years.
methods_attachment_point (str, optional) – Interpretation method for attachment (e.g., “Exposure_Share” or “Return_Period”).
methods_exhaustion_point (str, optional) – Interpretation method for exhaustion (e.g., “Exposure_Share” or “Return_Period”).
- Returns:
Sets principal, attachment, results, opt_min_thresh, opt_max_thresh, and pay_vs_dam on the instance.
- Return type:
None
- climada_petals.engine.cat_bonds.subarea_calculations.calc_payout(min_trig: float, max_trig: float, haz_int: DataFrame, max_pay: float)[source]#
Calculates payout values based on a linear payout function using hazard intensities and trigger thresholds.
- Parameters:
min_trig (float) – The minimum trigger threshold for hazard intensity.
max_trig (float) – The maximum trigger threshold for hazard intensity.
haz_int (pandas.DataFrame) – DataFrame containing hazard intensity values in the first column.
max_pay (float) – The maximum payout value.
- Returns:
payouts – Array of calculated payout values corresponding to each hazard intensity.
- Return type:
numpy.ndarray
climada_petals.engine.cat_bonds.utils_cat_bonds module#
- climada_petals.engine.cat_bonds.utils_cat_bonds.multi_level_es(losses: Series, confidence_levels: list[float])[source]#
Calculate Value at Risk (VaR) and Expected Shortfall (ES) for multiple confidence levels.
- Parameters:
losses (pandas.Series) – Loss samples used to estimate tail risk metrics.
confidence_levels (list[float]) – Confidence levels (e.g., [0.95, 0.99]).
- Returns:
var_list (list[float]) – VaR values in the order of the given confidence levels.
es_list (list[float]) – ES values in the order of the given confidence levels.
- climada_petals.engine.cat_bonds.utils_cat_bonds.allocate_single_payout(payout: float, nominals: ndarray)[source]#
Allocate a single payout across tranche nominals.
- Parameters:
payout (float) – Payout amount to allocate.
nominals (array-like) – 1D array of tranche nominal values.
- Returns:
remaining_nominals (numpy.ndarray) – Remaining nominal values after the payout.
payout_per_tranche (numpy.ndarray) – Amount allocated to each tranche.