7.9. Average Annual Risk Metrics

postprocessor.calculate_risk(input_array, hazard_array, return_period=1, max_return_period=5000)[source]

Calculate an average annual risk metric by integrating a fragility or vulnerability curve against a seismic hazard curve.

This function estimates the average annual value of input_array occurring over a given return period (typically annual where return_period = 1), using the hazard curve (which relates intensity measure levels to annual rates of exceedance). The interpretation of the result depends on what input_array represents:

  • If input_array is a fragility curve (intensity measure level vs. probability of exceeding a damage state), the result is the Average Annual Damage [State] Probability (AADP).

  • If input_array is a vulnerability curve (intensity measure level vs. expected loss ratio), the result is the Average Annual Loss Ratio (AALR).

The calculation integrates the product of input_array and the hazard curve over the specified range of intensity measure levels, accounting for the return period and a maximum return period threshold.

Parameters:
  • input_array (2D array) – A 2D array where the first column contains intensity measure levels, and the second column contains either the probability of exceedance of a damage state (a fragility curve, yielding the AADP) or the expected loss ratio (a vulnerability curve, yielding the AALR) for each intensity level.

  • hazard_array (2D array) – A 2D array where the first column contains intensity measure levels, and the second column contains the annual rates of exceedance (i.e., the probability of exceedance per year) for each intensity level.

  • return_period (float, optional, default=1) – The return period used to scale the hazard rate. This is the time span (in years) over which the average annual value is calculated. A typical value is 1 year, but longer periods can be used for multi-year assessments.

  • max_return_period (float, optional, default=5000) – The maximum return period threshold used to filter out very low hazard rates. The hazard curve is truncated to include only intensity levels with exceedance rates above this threshold.

Returns:

average_annual_value – The average annual value of input_array, calculated by integrating the product of input_array and the hazard curve over the given intensity measure levels. This is the AADP when input_array is a fragility curve, or the AALR when it is a vulnerability curve.

Return type:

float

Theoretical Background

calculate_risk integrates an intensity-measure-dependent curve against a seismic hazard curve to obtain an average annual risk metric. The same integral applies regardless of what the curve represents — only its interpretation changes:

  • Passing a fragility curve (probability of exceeding a damage state vs. intensity) yields the Average Annual Damage Probability (AADP) for that damage state (McGuire, 2004).

  • Passing a vulnerability curve (expected loss ratio vs. intensity) yields the Average Annual Loss Ratio (AALR) (Cornell & Krawinkler, 2000).

Classical integral

\[\text{Risk} = \int_0^{\infty} Y(\text{IM} = x)\; \left|\frac{d\lambda(x)}{dx}\right| dx\]

where:

  • \(Y(\text{IM} = x)\) is the value of the input curve at intensity \(x\) — either \(P(\text{DS} \geq ds \mid \text{IM} = x)\) for a fragility curve, or \(E[L \mid \text{IM} = x]\) for a vulnerability curve,

  • \(\lambda(x) = P(\text{IM} > x)\) is the mean annual rate of exceedance from the hazard curve, and

  • \(|d\lambda/dx|\) is the probability density of IM occurrences per year.

Discrete approximation

In practice the integral is evaluated numerically using midpoint quadrature over the IM bins of the hazard curve:

\[\text{Risk} \approx \sum_{j} Y(\text{IM} = \bar{x}_j) \cdot \Delta\lambda_j\]

where \(\bar{x}_j = (x_j + x_{j+1})/2\) is the midpoint of the \(j\)-th IM interval and \(\Delta\lambda_j = |\lambda(x_j) - \lambda(x_{j+1})|\) is the corresponding rate of occurrence.

Intensity levels with exceedance rates below \(1/T_{\max}\) (where \(T_{\max}\) is the maximum return period) are excluded to avoid numerical instability from very rare events.

Example

import numpy as np
from openquake.vmtk.postprocessor import postprocessor

pp = postprocessor()
# vulnerability_array: array of [IML, mean loss ratio] pairs
# fragility_array: array of [IML, probability of exceedance] pairs
# hazard_array: array of [IML, annual rate of exceedance] pairs
aalr = pp.calculate_risk(
    input_array=vulnerability_array,
    hazard_array=hazard_array,
)
print(f"AALR = {aalr:.4f}")

aadp = pp.calculate_risk(
    input_array=fragility_array,
    hazard_array=hazard_array,
)
print(f"AADP = {aadp:.4f}")