Global Carbon Budget: Fossil Fuel and Cement Production

In [1]:
%matplotlib inline
In [2]:
import math

import matplotlib.pyplot as plt
plt.rcParams.update({'mathtext.default': 'regular'})"ggplot")

from pandas_datapackage_reader import read_datapackage

Let's load the global fossil fuel and cement production emissions data from the Global Carbon Budget. It has been pre-processed for easy reading in as a data package.

In [3]:
ffc = read_datapackage("",
In [4]:
Value Source
Year Category
1959 Total 2453 CDIAC
1960 Total 2568 CDIAC
1961 Total 2579 CDIAC
1962 Total 2685 CDIAC
1963 Total 2832 CDIAC

Turn it into a wide table, with one variable per column.

In [5]:
ffc = ffc.drop("Source", axis=1).reset_index().pivot(columns="Category", values="Value", index="Year")

Conversion to Gt and to tonnes CO$_2$ instead of tonnes C.

In [6]:
ffc_Gt_CO2 = ffc[["Total", "Coal", "Oil", "Gas", "Cement", "Flaring"]] * 3.664 / 1000
In [7]:
ffc_Gt_CO2[["Coal", "Oil", "Gas", "Cement", "Flaring"]].plot.area(stacked=True)
plt.title("Global Emissions from Fossil Fuel and Cement Production (Data: Global Carbon Budget)")
plt.ylabel("Gt CO$_2$");
In [8]:
subcategories = ffc_Gt_CO2[["Coal", "Oil", "Gas", "Cement", "Flaring"]] 
ymax = math.ceil(subcategories.max(axis=1).max())
axes = subcategories.plot.area(subplots=True, layout=(3,2), ylim=(0, ymax))
plt.suptitle("Global Emissions from Fossil Fuel and Cement Production in Gt CO$_2$ (Data: Global Carbon Budget)");

Per-capita emissions

Per-Capita emissions are included in the dataset. We convert to t CO$_2$ per person per year.

In [9]:
per_capita_CO2 = read_datapackage("",
                       "fossil-fuel-cement-per-capita").drop("Source", axis=1) * 3.664
In [10]:
plt.title("Per-Capita Emissions in t CO$_2$ per person per year (Source: Global Carbon Budget)");

Let's pull in a population data package to have a look at the population growth.

In [11]:
population = read_datapackage("")
In [12]:
world_population = population[population["Country Name"] == "World"][["Year", "Value"]].set_index("Year")
world_population = world_population.Value
(world_population / 10**9).plot()
plt.title("World population in billion (Source: World Bank)");
In [13]:
ffc_t_CO2 = ffc_Gt_CO2 * 10**9

Re-creating the above plot of per-capita emissions by doing the calculation with the new dataset and plotting them together shows minor differences due to using different population data.

In [14]:
ax = ffc_t_CO2.Total.loc[1960:].divide(world_population).plot()
plt.legend(["Global Carbon Budget", "Global Carbon Budget/World Bank"],
          loc="upper left")
plt.title("Per-Capita Emissions in t CO$_2$ per person per year (Source: Global Carbon Budget/World Bank)");

Let's look at what the per-capita emissions consist of:

In [15]:
per_capita_categories = ffc_t_CO2[["Coal", "Oil", "Gas", "Cement"]].loc[1960:].divide(
    world_population, axis=0)

per_capita_categories.plot(subplots=True, layout=(2,2), ylim=(0, 2.3))

plt.suptitle("Per-Capita Emissions in t CO$_2$ per person per year (Source: Global Carbon Budget/World Bank)");
In [ ]: