Skip to content

aerocm.metrics.metrics_utils

Helper functions to calculate absolute and relative climate metrics.

co2_ipcc_pulse_absolute_metrics

co2_ipcc_pulse_absolute_metrics(time_horizon)

Calculate absolute climate metrics for a CO2 pulse emission based on IPCC.

Parameters:

Name Type Description Default
time_horizon int

Time horizon in years for the metrics calculation.

required

Returns:

Type Description
tuple

A tuple containing: - agwp_rf_co2 : float - agwp_erf_co2 : float - aegwp_rf_co2 : float - aegwp_erf_co2 : float - agtp_co2 : float - iagtp_co2 : float - atr_co2 : float

Source code in aerocm/metrics/metrics_utils.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def co2_ipcc_pulse_absolute_metrics(time_horizon: int) -> tuple:
    """
    Calculate absolute climate metrics for a CO2 pulse emission based on IPCC.

    Parameters
    ----------
    time_horizon : int
        Time horizon in years for the metrics calculation.

    Returns
    -------
    tuple
        A tuple containing:
        - agwp_rf_co2 : float
        - agwp_erf_co2 : float
        - aegwp_rf_co2 : float
        - aegwp_erf_co2 : float
        - agtp_co2 : float
        - iagtp_co2 : float
        - atr_co2 : float
    """
    co2_molar_mass = 44.01 * 1e-3  # [kg/mol]
    air_molar_mass = 28.97e-3  # [kg/mol]
    atmosphere_total_mass = 5.1352e18  # [kg]
    radiative_efficiency = 1.33e-5  # radiative efficiency [W/m^2/ppb] with AR6 value
    A_co2_unit = (
            radiative_efficiency
            * 1e9
            * air_molar_mass
            / (co2_molar_mass * atmosphere_total_mass)
    )  # RF per unit mass increase in atmospheric abundance of CO2 [W/m^2/kg]
    a = [0.2173, 0.2240, 0.2824, 0.2763]
    tau = [0, 394.4, 36.54, 4.304]
    model_remaining_fraction_species_co2 = np.zeros(time_horizon + 1)
    for k in range(0, time_horizon + 1):
        model_remaining_fraction_species_co2[k] = a[0]
        for i in [1, 2, 3]:
            model_remaining_fraction_species_co2[k] += a[i] * np.exp(-k / tau[i])
    agwp_co2 = A_co2_unit * a[0] * time_horizon
    for i in [1, 2, 3]:
        agwp_co2 += A_co2_unit * a[i] * tau[i] * (1 - np.exp(-time_horizon / tau[i]))
    agwp_rf_co2 = agwp_co2
    agwp_erf_co2 = agwp_co2
    aegwp_rf_co2 = agwp_co2
    aegwp_erf_co2 = agwp_co2
    c = [0.631, 0.429]
    d = [8.4, 409.5]
    model_temperature_co2 = np.zeros(time_horizon + 1)
    for k in range(0, time_horizon + 1):
        for j in [0, 1]:
            term = a[0] * c[j] * (1 - np.exp(-k / d[j]))
            for i in [1, 2, 3]:
                term += (
                    a[i]
                    * tau[i]
                    * c[j]
                    / (tau[i] - d[j])
                    * (np.exp(-k / tau[i]) - np.exp(-k / d[j]))
                )
            model_temperature_co2[k] += A_co2_unit * term
    iagtp_co2 = np.sum(model_temperature_co2)
    atr_co2 = 1 / time_horizon * iagtp_co2
    agtp_co2 = float(model_temperature_co2[-1])

    return (
        agwp_rf_co2,
        agwp_erf_co2,
        aegwp_rf_co2,
        aegwp_erf_co2,
        agtp_co2,
        iagtp_co2,
        atr_co2,
    )

absolute_metrics

absolute_metrics(radiative_forcing, effective_radiative_forcing, efficacy_erf, temperature, time_horizon)

Calculate absolute climate metrics for a given greenhouse gas.

Parameters:

Name Type Description Default
radiative_forcing ndarray | list

Radiative forcing time series.

required
effective_radiative_forcing ndarray | list

Effective radiative forcing time series.

required
efficacy_erf float

Efficacy based on effective radiative forcing.

required
temperature ndarray | list

Temperature time series.

required
time_horizon int

Time horizon in years for the metrics calculation.

required

Returns:

Type Description
tuple

A tuple containing: - agwp_rf : float - agwp_erf : float - aegwp_rf : float - aegwp_erf : float - agtp : float - iagtp : float - atr : float

Source code in aerocm/metrics/metrics_utils.py
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
def absolute_metrics(
        radiative_forcing: np.ndarray | list,
        effective_radiative_forcing: np.ndarray | list,
        efficacy_erf: float,
        temperature: np.ndarray | list,
        time_horizon: int,
) -> tuple:
    """
    Calculate absolute climate metrics for a given greenhouse gas.

    Parameters
    ----------
    radiative_forcing : np.ndarray | list
        Radiative forcing time series.
    effective_radiative_forcing : np.ndarray | list
        Effective radiative forcing time series.
    efficacy_erf : float
        Efficacy based on effective radiative forcing.
    temperature : np.ndarray | list
        Temperature time series.
    time_horizon : int
        Time horizon in years for the metrics calculation.

    Returns
    -------
    tuple
        A tuple containing:
        - agwp_rf : float
        - agwp_erf : float
        - aegwp_rf : float
        - aegwp_erf : float
        - agtp : float
        - iagtp : float
        - atr : float
    """

    agwp_rf = np.sum(radiative_forcing)
    agwp_erf = np.sum(effective_radiative_forcing)
    efficacy_rf = efficacy_erf * agwp_erf / agwp_rf
    aegwp_rf = efficacy_rf * np.sum(radiative_forcing)
    aegwp_erf = efficacy_erf * np.sum(effective_radiative_forcing)
    agtp = float(temperature[-1])
    iagtp = np.sum(temperature)
    atr = 1 / time_horizon * iagtp

    return agwp_rf, agwp_erf, aegwp_rf, aegwp_erf, agtp, iagtp, atr

relative_metrics

relative_metrics(agwp_rf_co2, agwp_erf_co2, aegwp_rf_co2, aegwp_erf_co2, agtp_co2, iagtp_co2, atr_co2, agwp_rf, agwp_erf, aegwp_rf, aegwp_erf, agtp, iagtp, atr)

Calculate relative climate metrics for a given greenhouse gas compared to CO2.

Parameters:

Name Type Description Default
agwp_rf_co2 float

AGWP based on radiative forcing for CO2.

required
agwp_erf_co2 float

AGWP based on effective radiative forcing for CO2.

required
aegwp_rf_co2 float

AEGWP based on radiative forcing for CO2.

required
aegwp_erf_co2 float

AEGWP based on effective radiative forcing for CO2.

required
agtp_co2 float

AGTP for CO2.

required
iagtp_co2 float

iAGTP for CO2.

required
atr_co2 float

ATR for CO2.

required
agwp_rf float

AGWP based on radiative forcing for the greenhouse gas.

required
agwp_erf float

AGWP based on effective radiative forcing for the greenhouse gas.

required
aegwp_rf float

AEGWP based on radiative forcing for the greenhouse gas.

required
aegwp_erf float

AEGWP based on effective radiative forcing for the greenhouse gas.

required
agtp float

AGTP for the greenhouse gas.

required
iagtp float

iAGTP for the greenhouse gas.

required
atr float

ATR for the greenhouse gas.

required

Returns:

Type Description
tuple

A tuple containing: - gwp_rf : float - gwp_erf : float - egwp_rf : float - egwp_erf : float - gtp : float - igtp : float - ratr : float

Source code in aerocm/metrics/metrics_utils.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
def relative_metrics(
    agwp_rf_co2: float,
    agwp_erf_co2: float,
    aegwp_rf_co2: float,
    aegwp_erf_co2: float,
    agtp_co2: float,
    iagtp_co2: float,
    atr_co2: float,
    agwp_rf: float,
    agwp_erf: float,
    aegwp_rf: float,
    aegwp_erf: float,
    agtp: float,
    iagtp: float,
    atr: float,
) -> tuple:
    """
    Calculate relative climate metrics for a given greenhouse gas compared to CO2.

    Parameters
    ----------
    agwp_rf_co2 : float
        AGWP based on radiative forcing for CO2.
    agwp_erf_co2 : float
        AGWP based on effective radiative forcing for CO2.
    aegwp_rf_co2 : float
        AEGWP based on radiative forcing for CO2.
    aegwp_erf_co2 : float
        AEGWP based on effective radiative forcing for CO2.
    agtp_co2 : float
        AGTP for CO2.
    iagtp_co2 : float
        iAGTP for CO2.
    atr_co2 : float
        ATR for CO2.
    agwp_rf : float
        AGWP based on radiative forcing for the greenhouse gas.
    agwp_erf : float
        AGWP based on effective radiative forcing for the greenhouse gas.
    aegwp_rf : float
        AEGWP based on radiative forcing for the greenhouse gas.
    aegwp_erf : float
        AEGWP based on effective radiative forcing for the greenhouse gas.
    agtp : float
        AGTP for the greenhouse gas.
    iagtp : float
        iAGTP for the greenhouse gas.
    atr : float
        ATR for the greenhouse gas.

    Returns
    -------
    tuple
        A tuple containing:
        - gwp_rf : float
        - gwp_erf : float
        - egwp_rf : float
        - egwp_erf : float
        - gtp : float
        - igtp : float
        - ratr : float
    """

    gwp_rf = agwp_rf / agwp_rf_co2
    gwp_erf = agwp_erf / agwp_erf_co2
    egwp_rf = aegwp_rf / aegwp_rf_co2
    egwp_erf = aegwp_erf / aegwp_erf_co2
    gtp = agtp / agtp_co2
    igtp = iagtp / iagtp_co2
    ratr = atr / atr_co2

    return gwp_rf, gwp_erf, egwp_rf, egwp_erf, gtp, igtp, ratr