Descriptive statistics of global primary energy supply (Table 2.6)

Notebook sr15_2.4.2.1_primary_energy_statistics

This notebook is based on the Release 1.1 of the IAMC 1.5C Scenario Explorer and Data and refers to the published version of the IPCC Special Report on Global Warming of 1.5C (SR15).

The notebook is run with pyam release 0.5.0.

The source code of this notebook is available on GitHub (release 2.0.2).

sr15_2.4.2.1_primary_energy_statistics

IPCC SR15 scenario assessment

Descriptive statistics of the primary energy development

This notebook computes indicators and diagnostics of the primary-energy timeseries by fuel for Table 2.6 in the IPCC's "Special Report on Global Warming of 1.5°C".

The scenario data used in this analysis can be accessed and downloaded at https://data.ene.iiasa.ac.at/iamc-1.5c-explorer.

Load pyam package and other dependencies

In [1]:
import pandas as pd
import numpy as np
import io
import itertools
import yaml
import math
import matplotlib.pyplot as plt
plt.style.use('style_sr15.mplstyle')
%matplotlib inline
import pyam
pyam - INFO: Running in a notebook, setting `pyam` logging level to `logging.INFO` and adding stderr handler

Import scenario data, categorization and specifications files

The metadata file with scenario categorisation and quantitative indicators can be downloaded at https://data.ene.iiasa.ac.at/iamc-1.5c-explorer.
Alternatively, it can be re-created using the notebook sr15_2.0_categories_indicators.

The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook.

In [2]:
sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')
pyam.utils - INFO: Reading `../data/iamc15_scenario_data_world_r2.0.xlsx`
In [3]:
sr1p5.load_meta('sr15_metadata_indicators.xlsx')
pyam.core - INFO: Importing metadata for 416 scenarios (for total of 416)
In [4]:
with open("sr15_specs.yaml", 'r') as stream:
    specs = yaml.load(stream, Loader=yaml.FullLoader)

rc = pyam.run_control()
for item in specs.pop('run_control').items():
    rc.update({item[0]: item[1]})
cats = specs.pop('cats')
cats_15 = specs.pop('cats_15')
cats_15_no_lo = specs.pop('cats_15_no_lo')
marker= specs.pop('marker')

Downselect scenario ensemble to categories of interest for this assessment

In [5]:
years = [2020, 2030, 2050]
In [6]:
df = sr1p5.filter(category=cats_15, year=years)

Initialize a pyam.Statistics instance

In [7]:
stats = pyam.Statistics(df=df,
                        filters=[('all 1.5', {}),
                                 ('no & lo os 1.5', {'category': cats_15_no_lo}),
                                 ('hi os 1.5', {'category': ['1.5C high overshoot']})
                                ], rows=True)
In [8]:
header='Primary energy supply (EJ)'
header_share='Share in primary energy (%)'
header_growth='Growth (factor)'

statistics_settings = dict(
    header=header,
    header_share=header_share,
    header_growth= header_growth,
    growth_year=2050,
    base_year=2020
)
In [9]:
def add_statistics(data, base, row, growth_year, base_year,
                   header, header_share, header_growth):
    stats.add(data, header=header, row=row)
    if base is not None:
        stats.add(data / base * 100, header=header_share, row=row)
    stats.add(data[growth_year] / data[base_year] - 1,
              header=header_growth, row=row,
              subheader='{}-{}'.format(base_year, growth_year))

Extract primary energy timeseries data and add summary statistics

In [10]:
pe = df.filter(variable='Primary Energy').timeseries()
pe.index = pe.index.droplevel([2, 3, 4])
In [11]:
add_statistics(pe, None, 'total primary', **statistics_settings)

Compute share of renewables by various types in primary energy

Only use scenarios for this indicator that report both biomass and the aggregate non-biomass timeseries - otherwise, the share would be distorted.

All renewables (biomass and non-biomass)

In [12]:
df_pe_res = df.filter()
df_pe_res.require_variable('Primary Energy|Non-Biomass Renewables', exclude_on_fail=True)
df_pe_res.require_variable('Primary Energy|Biomass', exclude_on_fail=True)
df_pe_res.filter(exclude=False, inplace=True)
pyam.core - INFO: 5 scenarios do not include required variable `Primary Energy|Non-Biomass Renewables`, marked as `exclude: True` in metadata
pyam.core - INFO: 5 scenarios do not include required variable `Primary Energy|Biomass`, marked as `exclude: True` in metadata
In [13]:
res = (
    df_pe_res.filter(variable=['Primary Energy|Biomass', 'Primary Energy|Non-Biomass Renewables'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [14]:
add_statistics(res, pe, 'renewables', **statistics_settings)

Biomass

In [15]:
res_bio = (
    df.filter(variable=['Primary Energy|Biomass'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [16]:
add_statistics(res_bio, pe, 'biomass', **statistics_settings)

Non-biomass renewables

In [17]:
res_non_bio = (
    df.filter(variable=['Primary Energy|Non-Biomass Renewables'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [18]:
add_statistics(res_non_bio, pe, 'non-biomass', **statistics_settings)

Renewable energy from wind and solar

As above, verify that scenarios report values for both 'Wind' and 'Solar'

In [19]:
df_win_sol = df.filter()
df_win_sol.require_variable('Primary Energy|Wind', exclude_on_fail=True)
df_win_sol.require_variable('Primary Energy|Solar', exclude_on_fail=True)
df_win_sol.filter(exclude=False, inplace=True)
pyam.core - INFO: 20 scenarios do not include required variable `Primary Energy|Wind`, marked as `exclude: True` in metadata
pyam.core - INFO: 20 scenarios do not include required variable `Primary Energy|Solar`, marked as `exclude: True` in metadata
In [20]:
win_sol = (
    df_win_sol.filter(variable=['Primary Energy|Wind',
                                'Primary Energy|Solar'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [21]:
add_statistics(win_sol, pe, 'wind & solar', **statistics_settings)

Compute share of nuclear in primary energy

In [22]:
nuc = (
    df.filter(variable=['Primary Energy|Nuclear'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [23]:
add_statistics(nuc, pe, 'nuclear', **statistics_settings)

Compute share of fossil in primary energy

In [24]:
fossil = (
    df.filter(variable=['Primary Energy|Coal', 'Primary Energy|Gas', 'Primary Energy|Oil'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [25]:
add_statistics(fossil, pe, 'fossil', **statistics_settings)
In [26]:
coal = (
    df.filter(variable=['Primary Energy|Coal'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [27]:
add_statistics(coal, pe, 'coal', **statistics_settings)
In [28]:
gas = (
    df.filter(variable=['Primary Energy|Gas'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [29]:
add_statistics(gas, pe, 'gas', **statistics_settings)
In [30]:
oil = (
    df.filter(variable=['Primary Energy|Oil'])
    .timeseries()
    .groupby(['model', 'scenario']).sum()
)
In [31]:
add_statistics(oil, pe, 'oil', **statistics_settings)

Display and export summary statistics for all 1.5C scenarios to xlsx

In [32]:
summary = (
    stats.summarize(center='median', fullrange=True)
    .reindex(columns=['count', header, header_share, header_growth], level=0)
)
summary
Out[32]:
count Primary energy supply (EJ) Share in primary energy (%) Growth (factor)
median (max, min) 2020 2030 2050 2020 2030 2050 2020-2050
all 1.5 total primary 85 582.12 (636.98, 483.22) 502.81 (749.05, 237.37) 580.78 (1012.50, 289.02) 0.03 (0.59, -0.51)
renewables 85 87.70 (101.60, 60.16) 139.48 (203.90, 87.75) 293.80 (584.78, 176.77) 15.03 (20.39, 10.60) 27.90 (62.15, 13.78) 60.80 (87.89, 28.47) 2.62 (6.71, 0.91)
biomass 85 61.35 (73.03, 40.54) 75.28 (113.02, 44.42) 154.13 (311.72, 40.36) 10.27 (14.23, 7.14) 14.38 (35.61, 9.03) 26.38 (54.10, 10.29) 1.71 (5.56, -0.42)
non-biomass 85 26.35 (36.58, 17.60) 61.60 (114.41, 25.79) 157.37 (409.94, 53.79) 4.40 (7.19, 2.84) 11.87 (26.54, 4.49) 28.60 (61.61, 9.87) 4.63 (13.46, 1.38)
wind & solar 70 10.93 (20.17, 1.91) 40.17 (82.66, 7.05) 125.31 (342.77, 27.95) 1.81 (3.66, 0.32) 8.24 (19.56, 1.54) 22.10 (51.52, 4.48) 11.64 (63.34, 3.13)
nuclear 85 10.93 (18.55, 8.52) 16.22 (41.73, 6.80) 24.48 (115.80, 3.09) 1.97 (3.37, 1.45) 3.27 (9.61, 1.20) 4.22 (13.60, 0.43) 1.34 (7.22, -0.64)
fossil 85 489.52 (543.29, 376.30) 343.48 (568.91, 70.14) 198.58 (608.39, 43.87) 83.05 (86.65, 77.73) 69.19 (82.94, 29.55) 33.06 (60.84, 7.70) -0.58 (0.12, -0.91)
coal 85 147.09 (193.55, 83.23) 49.46 (176.99, 5.97) 23.84 (134.69, 0.36) 25.72 (30.82, 17.19) 10.76 (26.35, 1.31) 4.99 (13.30, 0.05) -0.85 (-0.30, -1.00)
gas 85 135.58 (169.50, 105.01) 127.99 (208.55, 17.30) 88.97 (265.66, 14.92) 23.28 (28.39, 18.09) 24.02 (35.05, 7.08) 13.46 (34.83, 2.80) -0.37 (0.99, -0.88)
oil 85 195.02 (245.15, 151.02) 175.69 (319.80, 38.94) 93.48 (208.04, 15.07) 33.79 (42.24, 28.07) 32.01 (50.12, 16.41) 16.22 (27.30, 2.89) -0.54 (0.06, -0.93)
no & lo os 1.5 total primary 50 565.33 (619.70, 483.22) 464.50 (619.87, 237.37) 553.23 (725.40, 289.02) -0.05 (0.48, -0.51)
renewables 50 87.14 (101.60, 60.16) 146.96 (203.90, 87.75) 291.33 (584.78, 176.77) 14.90 (20.39, 10.60) 29.08 (62.15, 18.24) 60.24 (87.89, 38.03) 2.37 (6.71, 0.91)
biomass 50 60.41 (70.03, 40.54) 77.07 (113.02, 44.42) 152.30 (311.72, 40.36) 10.17 (13.66, 7.14) 17.22 (35.61, 9.08) 27.29 (54.10, 10.29) 1.71 (5.56, -0.42)
non-biomass 50 26.35 (36.57, 17.78) 62.58 (114.41, 25.79) 146.23 (409.94, 53.79) 4.37 (7.19, 3.01) 13.67 (26.54, 5.78) 27.98 (61.61, 12.04) 4.28 (13.46, 1.45)
wind & solar 44 10.93 (20.16, 2.61) 40.14 (82.66, 7.05) 121.82 (342.77, 27.95) 1.81 (3.66, 0.45) 9.73 (19.56, 1.54) 21.13 (51.52, 4.48) 10.00 (53.70, 3.71)
nuclear 50 10.91 (18.55, 8.52) 16.26 (36.80, 6.80) 24.51 (66.30, 3.09) 2.10 (3.37, 1.45) 3.52 (9.61, 1.32) 4.49 (12.84, 0.44) 1.24 (5.01, -0.64)
fossil 50 462.95 (520.41, 376.30) 310.36 (479.13, 70.14) 183.79 (394.71, 54.86) 82.53 (86.65, 77.73) 66.58 (77.30, 29.55) 32.79 (60.84, 8.58) -0.59 (-0.21, -0.89)
coal 50 136.89 (191.02, 83.23) 44.03 (127.98, 5.97) 24.15 (71.12, 0.92) 25.63 (30.82, 17.19) 9.62 (20.65, 1.31) 5.08 (11.43, 0.15) -0.83 (-0.57, -0.99)
gas 50 132.95 (152.80, 105.01) 112.51 (173.56, 17.30) 76.03 (199.18, 14.92) 23.10 (28.39, 18.09) 22.52 (35.05, 7.08) 13.23 (34.83, 3.68) -0.40 (0.85, -0.88)
oil 50 197.26 (245.15, 151.02) 156.16 (202.57, 38.94) 69.94 (167.52, 15.07) 34.81 (42.24, 29.00) 31.24 (39.84, 16.41) 12.89 (27.04, 2.89) -0.66 (-0.09, -0.93)
hi os 1.5 total primary 35 594.96 (636.98, 510.55) 559.04 (749.05, 419.28) 651.46 (1012.50, 415.31) 0.13 (0.59, -0.27)
renewables 35 89.84 (98.60, 66.57) 135.12 (159.84, 87.93) 323.21 (522.82, 177.66) 15.08 (18.58, 11.04) 23.65 (29.32, 13.78) 62.16 (86.26, 28.47) 2.68 (4.81, 1.17)
biomass 35 62.59 (73.03, 48.42) 69.05 (98.27, 56.54) 160.16 (310.10, 71.17) 10.30 (14.23, 8.03) 13.64 (16.37, 9.03) 23.79 (45.79, 10.64) 1.71 (3.71, 0.19)
non-biomass 35 28.46 (36.58, 17.60) 59.81 (92.12, 27.39) 164.91 (329.69, 55.72) 4.78 (6.64, 2.84) 10.23 (16.59, 4.49) 31.17 (45.86, 9.87) 6.10 (10.63, 1.38)
wind & solar 26 11.32 (20.17, 1.91) 40.31 (65.50, 8.14) 139.20 (275.47, 30.92) 1.95 (3.66, 0.32) 7.31 (11.61, 1.83) 26.01 (38.79, 6.33) 16.06 (63.34, 3.13)
nuclear 35 10.94 (14.27, 8.52) 16.12 (41.73, 6.80) 22.98 (115.80, 3.09) 1.86 (2.37, 1.45) 2.99 (5.57, 1.20) 4.17 (13.60, 0.43) 1.49 (7.22, -0.64)
fossil 35 497.30 (543.29, 407.49) 397.76 (568.91, 300.63) 209.80 (608.39, 43.87) 83.17 (86.59, 79.39) 73.87 (82.94, 68.00) 33.58 (60.09, 7.70) -0.56 (0.12, -0.91)
coal 35 155.65 (193.55, 118.40) 70.99 (176.99, 19.15) 18.95 (134.69, 0.36) 25.94 (30.82, 19.10) 14.53 (26.35, 3.64) 4.14 (13.30, 0.05) -0.87 (-0.30, -1.00)
gas 35 138.01 (169.50, 107.07) 147.43 (208.55, 76.45) 97.71 (265.66, 15.96) 23.61 (27.35, 19.26) 25.79 (32.73, 14.69) 15.67 (33.80, 2.80) -0.31 (0.99, -0.88)
oil 35 195.02 (236.40, 154.66) 198.50 (319.80, 102.10) 126.20 (208.04, 24.68) 32.21 (38.87, 28.07) 33.27 (50.12, 24.35) 18.61 (27.30, 4.51) -0.34 (0.06, -0.87)
In [33]:
summary.to_excel('output/table_2.6_primary_energy_supply.xlsx')
In [ ]: