Descriptive statistics of electricity generation by fuel (Table 2.7)¶
Notebook sr15_2.4.2.2_electricity_generation_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).
IPCC SR15 scenario assessment¶
Descriptive statistics of electricity generation¶
This notebook computes indicators and diagnostics of the primary-energy timeseries by fuel for Table 2.7 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¶
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
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.
sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')
sr1p5.load_meta('sr15_metadata_indicators.xlsx')
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¶
years = [2020, 2030, 2050]
df = sr1p5.filter(category=cats_15, year=years)
Initialize a pyam.Statistics
instance¶
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)
header='Electricity generation (EJ)'
header_share='Share in electricity generation (%)'
header_growth='Growth (factor)'
statistics_settings = dict(
header=header,
header_share='Share in electricity generation (%)',
header_growth='Growth (factor)',
growth_year=2050,
base_year=2020
)
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 total electricity generation timeseries and add summary statistics¶
se = df.filter(variable='Secondary Energy|Electricity').timeseries()
se.index = se.index.droplevel([2, 3, 4])
add_statistics(se, None, 'total generation', **statistics_settings)
Compute share of renewables by various types in electricity generation¶
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)¶
df_pe_res = df.filter()
df_pe_res.require_variable('Secondary Energy|Electricity|Non-Biomass Renewables', exclude_on_fail=True)
df_pe_res.require_variable('Secondary Energy|Electricity|Biomass', exclude_on_fail=True)
df_pe_res.filter(exclude=False, inplace=True)
res = (
df_pe_res.filter(variable=['Secondary Energy|Electricity|Biomass',
'Secondary Energy|Electricity|Non-Biomass Renewables'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(res, se, 'renewables', **statistics_settings)
Biomass¶
res_bio = (
df_pe_res.filter(variable=['Secondary Energy|Electricity|Biomass'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(res_bio, se, 'biomass', **statistics_settings)
Non-biomass renewables¶
res_non_bio = (
df_pe_res.filter(variable=['Secondary Energy|Electricity|Non-Biomass Renewables'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(res_non_bio, se, 'non-biomass', **statistics_settings)
Renewable energy from wind and solar¶
As above, verify that scenarios report values for both 'Wind' and 'Solar'
df_win_sol = df.filter()
df_win_sol.require_variable('Secondary Energy|Electricity|Solar', exclude_on_fail=True)
df_win_sol.require_variable('Secondary Energy|Electricity|Wind', exclude_on_fail=True)
df_win_sol.filter(exclude=False, inplace=True)
win_sol = (
df_win_sol.filter(variable=['Secondary Energy|Electricity|Solar',
'Secondary Energy|Electricity|Wind '])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(win_sol, se, 'wind & solar', **statistics_settings)
Compute share of nuclear in electricity generation¶
nuc = (
df.filter(variable=['Secondary Energy|Electricity|Nuclear'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(nuc, se, 'nuclear', **statistics_settings)
Compute share of fossil in electricity generation¶
df_fossil = df.filter()
df_fossil.require_variable('Secondary Energy|Electricity|Coal', exclude_on_fail=True)
df_fossil.require_variable('Secondary Energy|Electricity|Gas', exclude_on_fail=True)
df_fossil.require_variable('Secondary Energy|Electricity|Oil', exclude_on_fail=True)
df_fossil.filter(exclude=False, inplace=True)
fossil = (
df.filter(variable=['Secondary Energy|Electricity|Coal',
'Secondary Energy|Electricity|Gas',
'Secondary Energy|Electricity|Oil'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(fossil, se, 'fossil', **statistics_settings)
coal = (
df_fossil.filter(variable=['Secondary Energy|Electricity|Coal'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(coal, se, 'coal', **statistics_settings)
gas = (
df_fossil.filter(variable=['Secondary Energy|Electricity|Gas'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(gas, se, 'gas', **statistics_settings)
oil = (
df_fossil.filter(variable=['Secondary Energy|Electricity|Oil'])
.timeseries()
.groupby(['model', 'scenario']).sum()
)
add_statistics(oil, se, 'oil', **statistics_settings)
Display and export summary statistics for all 1.5°C pathways to xlsx
¶
summary = (
stats.summarize(center='median', fullrange=True)
.reindex(columns=['count', header, header_share, header_growth], level=0)
)
summary
summary.to_excel('output/table_2.7_electricity_generation.xlsx')