Coal-free Britain: How did they get there and what comes next?

I am a Master’s student in public policy, taking baby steps to become a data analyst on DataQuest. Before I started my Master’s, I had worked for many environmental campaign organizations. I wanted to take a more data-driven and evidence-based approach to creating impact. So I quit my job and started learning data science.

This is my first personal project to share publicly. I would really appreciate your input, so that I can find ways to improve my work. Thank you for reading!

Coal-free Britain: How did they get there and what comes next?

Great Britain is daring greatly toward the end of the coal era. Only two years after the government’s official commitment to coal phase-out, Britain’s electricity sector reportedly went two months without coal power. As a sustainable energy advocate, I was thrilled about this news. Then I started pondering these questions:

  • What are primary sources of electricity generation in Britain, now that coal is gone? Has its electricity become “greener”?
  • What led to the decline of coal? What are some historical trends?
  • Can the growth of renewables pace with the rate of decline of coal?
  • What is the effect of coal phase-out on reducing carbon emissions?

Data

Grid Watch provides data on electricity demand and supply in Britain by energy source. I will analyze this dataset to answer these questions. To answer the last question, I will utilize carbon emissions data from Our World in Data.

Data Cleaning

# Load dataset from Grid Watch 
elec_raw <- read.csv("data/gridwatch.csv")

## Extract years from the time data
elec_raw$year <- year(ymd_hms(elec_raw$timestamp))

## Calculate total output of all energy sources. We sum the capacities of pumped, hydro, oil, ocgt sources because they are negligible.
elec_raw <- elec_raw %>% mutate(
  renewable = wind + solar + biomass,
  other = pumped + hydro + oil + ocgt)

## Select variables of interest. We rename "ccgt" variable to "gas" for easy use of terms. We consider wind, solar, biomass as one category (renewable).
elec <- elec_raw %>% select(id, year, coal, nuclear, ccgt, renewable, other) %>% rename(gas=ccgt)

## Check for missing values 
colSums(is.na(elec))

# Load dataset from Our World in Data, select Britain and select variables of interest 
co2_raw <- read.csv("data/owid-co2-data.csv") %>% filter(country=="United Kingdom", year > 1989) %>% select(year, co2, coal_co2, energy_per_capita, population, gdp)

## Check for missing values 
colSums(is.na(co2_raw))

Data Wrangling

In the Grid Watch dataset, the unit of measurement for electricity output from each source is in MW. In other words, each value represents the total capacity of all power generators by source that was active at one point in time. For the purpose of analysis, we will take the yearly average of the active capacity by source.

# Pivot the dataset longer and calculate yearly average by source.
elec_long <- elec %>% pivot_longer(cols=coal:other,
                              names_to="source",
                              values_to="output") %>% filter(year!=2021)
elec_calc <- elec_long %>% 
  group_by(year, source) %>% 
  summarize(output = round(mean(output),2) ) %>% arrange(desc(year)) %>% as.data.frame()

The CO2 dataset provided by Our World in Data will be merged with a subset of the Grid Watch data to compare trends in CO2 emissions and coal power generation.

What are the primary sources of electricity generation in Britain, now that coal is gone? Has its electricity become “greener”?

# Calculate the energy mix in 2020 
mix_2020 <- elec_calc %>% filter(year==2020) %>% select(-year) %>%
  mutate(share=round(output/sum(output)*100,2)) %>% arrange(desc(share)) 

# Put the results in a nice table
table1 <- gt(mix_2020) %>% tab_header(
  title="Britain's Electricity Mix in 2020") %>% tab_source_note(
  source_note = "Source: Grid Watch"
) %>% cols_label(
  source="Energy",
  output="Output (MW)",
  share = "Share in %")

Gas is the most dominant source of electricity in Britain (40.15%). Coal power accounted for only 1.85%. Renewables have risen reasonably, accounting for 35.44% of the energy mix. Although the decline of coal should be celebrated, gas should ultimately be replaced by renewable energy sources for the sake of the climate. Nuclear power is a subject of heated debate. Regardless of the heated nuclear politics, (the cost of renewable energy has fallen significantly (88% for utility-scale solar), while that of nuclear has gone up by 23%. BBC’s 2019 Energy Briefing reports that nuclear power stations are experiencing delays due to similar concerns.

What led to the decline of coal?

The decline of coal power in Britain was already underway well before the government’s announcement of the coal phase-out commitment in 2018. After reaching its peak in 2012, coal started rapidly declining, as the graph below demonstrates. According to Carbon Brief, 8.4GW of coal power plants have closed since 2010. The closure of the last coal power station in Britain is scheduled for 2025.

The decline of coal can be attributed to introducing strict regulations for air pollution control and tackling climate change. Of particular influence was imposing carbon taxes on companies that produce electricity from fossil fuels in 2013. In addition, all new coal power plants were required to be equipped with a carbon capture and storage (CCS) system, which is prohibitively expensive. The carbon tax and CCS requirement led to the loss of the business case for coal. The graph below shows that coal power generation declined by 96.52% (!!) since 2013 when the carbon tax was introduced.

# Graph
graph1 <- ggplot(coal, aes(x=year, y=output)) + geom_area(alpha=0.5) +
  labs(title = "Change in Coal Power Loaded Capacity 2011-2020",
        y="Output in MW") +
    theme_classic() + 
  theme(axis.title.x=element_blank()) + 
  geom_point(alpha=0.4) +
  geom_text_repel(aes(label=output)) +   
  scale_x_continuous(breaks=pretty_breaks()) + 
  geom_vline(xintercept=2013, linetype="dashed", color="red") #Dotted red line shows the year in which carbon tax was introduced. 

How has other sources of electricity flared in comparison to coal? Can the growth of renewables pace with the rate of decline of coal?

A general overview of the change in electricity output of all data sources shows that the production of electricity from coal has dropped significantly over the years. However, the growth of renewable energies (solar, wind, biomass) is slower than the pace at which coal has declined. Instead, gas has replaced coal, accounting for 40.15 of the energy mix. Meanwhile, nuclear power generation shows a slow decline, taking up 20.03 of the energy mix.

# Factorize energy sources for plotting
elec_calc$source <- factor(elec_calc$source, levels=c("coal","renewable", "gas", "nuclear", "other"))

# Plot change in energy output by source 
graph2 <- ggplot(elec_calc, aes(x=year, y=output, fill=source)) +
  geom_area(alpha=0.8) +
  labs(title="Change in loaded generation capacity by source (2011-2021)",
       x="Year", y="Yearly average output (MW)") +
  theme_classic() + ylim(0,40000) +
  scale_x_continuous(breaks=pretty_breaks())

Has the decline of coal power contributed to reducing carbon emissions in Britain?

Compared to 1990, Britain’s carbon emissions had decreased by 36.91%. The red dotted line marks the year 2013 when carbon pricing was introduced to Britain.

# Graph relative change in carbon emissions and coal production by year.
graph3 <- ggplot(co2_calc, aes(x=year, y=change_1990)) +
  geom_line(color="blue", size=1) +
  theme_classic() + 
  labs(y="% Change", title="Change in Carbon Emissions Compared to 1990 in Britain") + 
  theme(plot.title=element_text(hjust=0.5)) + 
  geom_vline(xintercept=2013, color="red", linetype="dashed") 

It would be great if we could estimate the effect of coal’s decline on carbon emissions through regression analysis. However, the difference in the granularity of the datasets (the power generation data is collected every 5 minutes, whereas the emissions data are collected every year) and missing data leave us with only 6 data points. Since running a regression on such a small dataset could lead to misleading analysis, I will calculate the correlation coefficient instead.

# Merge datasets 
cov_data <- merge(co2_calc, coal) 
cor.test(cov_data$co2, cov_data$output, method="pearson")

Coal power generation and carbon emissions are positively associated, with high statistical significance!

Conclusion: Goodbye Coal, Hello Renewables!

The coal era has (almost) ended in Britain. The introduction of a carbon tax in 2013 was an important factor that accelerated the decline of coal, reducing active coal power capacity by 96.52%. However, Britain’s electricity has not necessarily become “greener”, since gas has replaced the place of coal, taking up 40.15% of the energy mix. This is problematic for the climate agenda. More policy support is necessary to expand renewable capacity, smart grid infrastructure and energy storage systems. Overall, the decline in coal has contributed significantly to Britain’s climate agenda.

*This article was originally published for my blog, Conscious Table. The source code can be found in my Github portfolio.

10 Likes