continuous_timeseries.budget_compatible_pathways#
Creation of emissions pathways compatible with a given budget
Functions:
| Name | Description |
|---|---|
calculate_linear_net_zero_time |
Calculate the net-zero time, assuming a linear path to net-zero |
convert_to_annual_constant_emissions |
Convert a timeseries to annual constant emissions |
convert_to_annual_time_axis |
Convert a timeseries to an annual time axis |
derive_linear_path |
Derive a linear pathway that stays within a given budget |
derive_symmetric_quadratic_path |
Derive a quadratic pathway that stays within a given budget |
calculate_linear_net_zero_time #
calculate_linear_net_zero_time(
budget: PINT_SCALAR,
budget_start_time: PINT_SCALAR,
emissions_start: PINT_SCALAR,
) -> PINT_SCALAR
Calculate the net-zero time, assuming a linear path to net-zero
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
budget
|
PINT_SCALAR
|
Budget to match |
required |
budget_start_time
|
PINT_SCALAR
|
Time from which the budget is available. E.g., if the budget is available from 1 Jan 2025,
supply |
required |
emissions_start
|
PINT_SCALAR
|
Emissions from which the linear path should start |
required |
Returns:
| Type | Description |
|---|---|
PINT_SCALAR
|
Net-zero time |
Source code in src/continuous_timeseries/budget_compatible_pathways.py
convert_to_annual_constant_emissions #
convert_to_annual_constant_emissions(
ts: Timeseries, name_res: str | None = None
) -> Timeseries
Convert a timeseries to annual constant emissions
In other words, to annual-average emissions (or annual-total, depending on how you think about emissions), like what countries report.
If the time axis of ts starts with an integer year,
then you can simply sum the output emissions and you will get
the same cumulative emissions as ts.
If the time axis of ts does not start with an integer year,
then it is more complicated because your first time step
will not be a full year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ts
|
Timeseries
|
Timeseries to convert to an annual time axis. |
required |
name_res
|
str | None
|
Name to use for the result. If not supplied, we use |
None
|
Returns:
| Type | Description |
|---|---|
Timeseries
|
|
Source code in src/continuous_timeseries/budget_compatible_pathways.py
convert_to_annual_time_axis #
convert_to_annual_time_axis(ts: Timeseries) -> Timeseries
Convert a timeseries to an annual time axis
This is just a convenience method. It has minimal checks, so may not always produce sensible results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ts
|
Timeseries
|
Timeseries to convert to an annual time axis. |
required |
Returns:
| Type | Description |
|---|---|
Timeseries
|
If |
Source code in src/continuous_timeseries/budget_compatible_pathways.py
derive_linear_path #
derive_linear_path(
budget: PINT_SCALAR,
budget_start_time: PINT_SCALAR,
emissions_start: PINT_SCALAR,
name_res: str | None = None,
) -> Timeseries
Derive a linear pathway that stays within a given budget
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
budget
|
PINT_SCALAR
|
Budget to match |
required |
budget_start_time
|
PINT_SCALAR
|
Time from which the budget is available. E.g., if the budget is available from 1 Jan 2025,
supply |
required |
emissions_start
|
PINT_SCALAR
|
Emissions from which the linear path should start |
required |
name_res
|
str | None
|
Name to use for the result. If not supplied, we use a verbose but clear default. |
None
|
Returns:
| Type | Description |
|---|---|
Timeseries
|
Linear pathway to net-zero in line with the budget |
Notes
We're solving for emissions, \(y\), as a function of time, \(x\). We pick a linear emissions pathway
Simplifying slightly, we have
where \(e_0\) is emissions at the known time (normally today), \(x_0\), and \(x_{nz}\) is the net-zero time.
By geometry, the integral of this curve between \(x_0\) and \(x_nz\) is:
You can also do this with calculus:
This integral should be equal to the allowed buget:
therefore
Source code in src/continuous_timeseries/budget_compatible_pathways.py
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 81 82 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 129 130 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 | |
derive_symmetric_quadratic_path #
derive_symmetric_quadratic_path(
budget: PINT_SCALAR,
budget_start_time: PINT_SCALAR,
emissions_start: PINT_SCALAR,
name_res: str | None = None,
) -> Timeseries
Derive a quadratic pathway that stays within a given budget
The major downside of this approach is
that the gradient of the output path is zero at budget_start_time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
budget
|
PINT_SCALAR
|
Budget to match |
required |
budget_start_time
|
PINT_SCALAR
|
Time from which the budget is available. E.g., if the budget is available from 1 Jan 2025,
supply |
required |
emissions_start
|
PINT_SCALAR
|
Emissions from which the quadratic path should start. |
required |
name_res
|
str | None
|
Name to use for the result. If not supplied, we use a verbose but clear default. |
None
|
Returns:
| Type | Description |
|---|---|
Timeseries
|
Symmetric quadratic pathway to net-zero in line with the budget |
Notes
We're solving for emissions, \(y\), as a function of time, \(x\). We pick a quadratic emissions pathway comprised of two pieces. The two pieces are equal in size and split the time period from the known time (normally today), \(x_0\), to the net zero time, \(x_{nz}\), in two. For convenience, we also define the halfway to net-zero point, \(x_{nzh} = \frac{x_0 + x_{nz}}{2}\).
Therefore
To set the constants, we need some boundary conditions.
At \(x = x_0\), emissions should be equal to the starting emissions, \(e_0\). This immediately sets \(c_1 = e_0\).
We also choose to set the quadratics such that at the time point which is halfway to net zero, emissions are half of their original value. Thus, at \(x = x_{nzh}\), emissions should be \(e_0 / 2\). This immediately sets \(c_2 = e_0 / 2\).
This condition also means that the decrease in emissions should be the same between \(x_0\) and \(x_{nzh}\) as it is between \(x_{nzh}\) and \(x_{nz}\). We also want the gradient to be continuous at the boundary between the two quadratics.
As a result, we can see that the two quadratics are simply a translation and a reflection of each other (they have the same change between their defining points and the same gradient at the boundary between the two intervals, so there are no more degrees of freedom with which we could introduce different shapes), i.e. they are symmetric (about a carefully chosen axis).
By the symmetry argument, we have that \(a_1 = -a_2\) and the gradient at \(x=x_0\) must equal the gradient at \(x=x_{nx}\). The gradient at \(x=x_{nx}\) is zero, therefore
We can now use the fact that \(y(x_{nzh}) = e_0 / 2\) to solve for \(a_1\), and therefore also \(a_2\).
The last constant to solve for is \(b_2\). We solve for this using the first-order continuity constraint at the boundary.
In summary, our constants are
The last question is, where does the net-zero year come from? To answer this, first consider the integral of our function from \(x_0\) to \(x_{nz}\)
We next note that
Hence the cubic terms cancel because \(a_1 = -a_2\) and we are left with
Put more simply, the integral is simply equal to the integral of a straight-line to net-zero. Hence, we can simply use the net-zero year of a linear pathway to net-zero in line with the budget, and our quadratic pathway will have the same cumulative emissions (i.e. will also match the budget).
As a result, our recipe is:
- Calculate the net-zero year of a straight-line pathway to net-zero year.
- Use that net-zero year to calculate our constants.
Source code in src/continuous_timeseries/budget_compatible_pathways.py
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |