If the world is going to reduce green house gas (GHG) emissions over the coming decades by way of the current strategy of massively building out new renewables, then one thing has to happen or it will be all for nought. The rate of growth of new renewables must be greater than the growth in primary energy consumption. The alternative is self-explantory. This analysis is an attempt to answer that question, is the growth in new renewables usage greater than the growth in primary energy consumption.
Blah
library(tidyverse)
growth <- function(x) {(x / lag(x)) - 1}
abs_growth <- function(x) {x - lag(x)}
clean_names <- function(x) {tolower(stringr::str_replace(x, " ", "_"))}
Renewable energy data retrieved from the OECD here. Similarly for total primary energy here.
primary_energy <-
readr::read_csv("./data/raw/primary_energy.csv") %>%
rename_all(clean_names) %>%
select(-flag_codes, -frequency, -subject, -indicator) %>%
filter(measure == "MLN_TOE",
!(location %in% c("G20", "EU28", "OECD", "OEU", "WLD"))) %>%
rename(country_iso3 = location, year = time,
million_tonnes_equivalent = value) %>%
select(-measure)
## Parsed with column specification:
## cols(
## LOCATION = col_character(),
## INDICATOR = col_character(),
## SUBJECT = col_character(),
## MEASURE = col_character(),
## FREQUENCY = col_character(),
## TIME = col_integer(),
## Value = col_double(),
## `Flag Codes` = col_character()
## )
# Country codes retrieved from: http://www.oecd.org/migration/mig/34107835.xls
country_codes <- readr::read_csv("https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv") %>%
rename(alpha_3 = `alpha-3`) %>%
select(name, alpha_3)
## Parsed with column specification:
## cols(
## name = col_character(),
## `alpha-2` = col_character(),
## `alpha-3` = col_character(),
## `country-code` = col_character(),
## `iso_3166-2` = col_character(),
## region = col_character(),
## `sub-region` = col_character(),
## `intermediate-region` = col_character(),
## `region-code` = col_character(),
## `sub-region-code` = col_character(),
## `intermediate-region-code` = col_character()
## )
primary_energy_clean <-
primary_energy %>%
filter(year %in% 1990:2015) %>%
left_join(country_codes, by = c("country_iso3" = "alpha_3")) %>%
rename(country = name)
We have similar issues to above in regards cleaning. If we look at the number of categories we can see most are redundant in this slice of the database we are importing.
renewable_energy <-
readr::read_csv("./data/raw/renewable_primary_energy.csv") %>%
rename_all(clean_names)
## Parsed with column specification:
## cols(
## LOCATION = col_character(),
## INDICATOR = col_character(),
## SUBJECT = col_character(),
## MEASURE = col_character(),
## FREQUENCY = col_character(),
## TIME = col_integer(),
## Value = col_double(),
## `Flag Codes` = col_character()
## )
renewable_energy %>% select_if(is.character) %>% map(unique)
## $location
## [1] "AUS" "AUT" "BEL" "CAN" "CZE" "DNK" "FIN" "FRA" "DEU" "GRC"
## [11] "HUN" "ISL" "IRL" "ITA" "JPN" "KOR" "LUX" "MEX" "NLD" "NZL"
## [21] "NOR" "POL" "PRT" "SVK" "ESP" "SWE" "CHE" "TUR" "GBR" "USA"
## [31] "OEU" "ALB" "DZA" "ARG" "ARM" "AZE" "BGD" "BLR" "BIH" "BRA"
## [41] "BRN" "BGR" "KHM" "CHL" "CHN" "COL" "HRV" "CYP" "EGY" "EST"
## [51] "ETH" "GEO" "GHA" "HTI" "HKG" "IND" "IDN" "IRN" "ISR" "KAZ"
## [61] "LVA" "LTU" "MKD" "MYS" "MLT" "MDA" "MOZ" "NGA" "PAK" "PRY"
## [71] "PER" "PHL" "ROU" "RUS" "SAU" "SGP" "SVN" "ZAF" "SDN" "TWN"
## [81] "TZA" "THA" "UKR" "ARE" "URY" "VNM" "ZMB" "WLD" "SRB" "MNE"
## [91] "G20" "EU28" "OECD" "AGO" "BHR" "BEN" "BOL" "BWA" "CMR" "COG"
## [101] "CRI" "CIV" "CUB" "PRK" "COD" "DOM" "ECU" "SLV" "ERI" "GAB"
## [111] "GTM" "HND" "IRQ" "JAM" "JOR" "KEN" "KWT" "KGZ" "LBN" "LBY"
## [121] "MNG" "MAR" "MMR" "NAM" "NPL" "NIC" "NER" "OMN" "PAN" "QAT"
## [131] "SEN" "LKA" "SYR" "TJK" "TGO" "TTO" "TUN" "TKM" "UZB" "VEN"
## [141] "YEM" "ZWE"
##
## $indicator
## [1] "RENEWABLE"
##
## $subject
## [1] "TOT"
##
## $measure
## [1] "KTOE" "PC_PRYENRGSUPPLY"
##
## $frequency
## [1] "A"
##
## $flag_codes
## [1] NA "L"
So we don’t want aggregate countries like G20 and EU28 etc. We’re only intrested in the absolute value, in this case kilo-tonnes of equivalent. The L lable seems to only denote missing data which we can identify easily with NA’s. frequency, subject. indicator, flag_codes and measure are all now redundant.
renewable_energy <-
renewable_energy %>%
select(-flag_codes, -frequency, -subject, -indicator) %>%
filter(measure == "KTOE",
!(location %in% c("G20", "EU28", "OECD", "OEU", "WLD"))) %>%
rename(country_iso3 = location, year = time,
million_tonnes_equivalent = value) %>%
select(-measure) %>%
mutate(million_tonnes_equivalent = million_tonnes_equivalent / 1000)
renewable_energy_clean<-
renewable_energy %>%
filter(year %in% 1990:2015) %>%
left_join(country_codes, by = c("country_iso3" = "alpha_3")) %>%
rename(country = name)
Thankfully the people at the OECD seem to have used the ISO 3-letter standard names for the countries, so we have no missing country names.
renewable_energy_clean %>% select(country) %>% is.na() %>%
table() %>% as_tibble() %>% knitr::kable(caption = "Is country NA?")
| . | n |
|---|---|
| FALSE | 3562 |
Plotting all the data we can see some countries only have data for recent years.
primary_energy %>%
ggplot(aes(year, million_tonnes_equivalent, fill = country_iso3)) +
geom_bar(stat = "identity") +
blorg::blog_theme +
theme(legend.position = "none")
## Warning: Removed 1860 rows containing missing values (position_stack).
There appears to be some missing countries before 1990 and again 1971. 2016 is also incomplete
Filtering to more recent years we can get a far more complete dataset.
primary_energy_clean %>%
filter(stringr::str_detect(country, "China|United States|India")) %>%
ggplot(aes(year, million_tonnes_equivalent, fill = country)) +
geom_bar(stat = "identity") +
blorg::blog_theme
is.na(primary_energy$million_tonnes_equivalent) %>% table() %>%
knitr::kable(caption = "Missing Data From Entire Dataset")
| . | Freq |
|---|---|
| FALSE | 5949 |
| TRUE | 1860 |
is.na(primary_energy_clean$million_tonnes_equivalent) %>% table() %>%
knitr::kable(caption = "Missing Data From 1990 Onwards")
| . | Freq |
|---|---|
| FALSE | 3529 |
| TRUE | 33 |
primary_energy_clean %>%
filter(is.na(million_tonnes_equivalent)) %>% select(country) %>%
unique() %>% knitr::kable(caption = "Countries with missing data between 1990 - 2015")
| country |
|---|
| Cambodia |
| Montenegro |
| Eritrea |
| Namibia |
| Niger |
renewable_energy %>%
ggplot(aes(year, million_tonnes_equivalent, fill = country_iso3)) +
geom_bar(stat = "identity") +
blorg::blog_theme +
theme(legend.position = "none")
## Warning: Removed 1859 rows containing missing values (position_stack).
is.na(renewable_energy$million_tonnes_equivalent) %>% table() %>%
knitr::kable(caption = "Missing Data From Entire Dataset")
| . | Freq |
|---|---|
| FALSE | 5950 |
| TRUE | 1859 |
is.na(renewable_energy_clean$million_tonnes_equivalent) %>% table() %>%
knitr::kable(caption = "Missing Data From 1990 Onwards")
| . | Freq |
|---|---|
| FALSE | 3529 |
| TRUE | 33 |
renewable_energy_clean %>%
filter(is.na(million_tonnes_equivalent)) %>% select(country) %>%
unique() %>% knitr::kable(caption = "Countries with missing data between 1990 - 2015")
| country |
|---|
| Cambodia |
| Montenegro |
| Eritrea |
| Namibia |
| Niger |
Combining the total primary energy and renewables primary energy datasets we can then calculated the growth and absolute growth in order to make comparisons between how renewables are fairing versus the overall picture.
primary_energy_enriched <-
primary_energy_clean %>%
rename(total_mtoe = million_tonnes_equivalent) %>%
left_join((renewable_energy_clean %>%
select(year, country, million_tonnes_equivalent)),
by = c("country", "year")) %>%
rename(renewables_mtoe = million_tonnes_equivalent) %>%
select(-country_iso3) %>%
gather(energy_source, mtoe, total_mtoe, renewables_mtoe)
# Anything with "mtoe" in title will have growth calculated.
# Adding more primary energy sources to dataset should "just work"
primary_energy_enriched <-
primary_energy_enriched %>%
group_by(country, energy_source) %>%
mutate_at(vars(contains("mtoe")),
funs(growth = growth, abs_growth = abs_growth)) %>%
ungroup()
saveRDS(primary_energy_enriched,
"./data/processed/primary_energy_enriched.rds")
sum_growth <- function(x){ sum(growth(x), na.rm = TRUE) }
sum_abs_growth <- function(x){ sum(abs_growth(x), na.rm = TRUE) }
my_sum <- function(x){ sum(x, na.rm = TRUE)}
yearly_energy_summary <-
primary_energy_enriched %>%
filter(year != 1990) %>%
group_by(year, energy_source) %>%
summarise_at(vars(contains("mtoe")),
funs(growth = sum(growth, na.rm = TRUE),
abs_growth = sum(abs_growth, na.rm = TRUE),
total_mtoe = my_sum))
yearly_energy_summary %>% glimpse()
## Observations: 50
## Variables: 5
## $ year <int> 1991, 1991, 1992, 1992, 1993, 1993, 1994, 1994, ...
## $ energy_source <chr> "renewables_mtoe", "total_mtoe", "renewables_mto...
## $ growth <dbl> 5.0857873, 1.1281082, Inf, 2.3999843, 4.3813733,...
## $ abs_growth <dbl> 18.50268, 55.83000, 16.74805, -4.89000, 13.65106...
## $ total_mtoe <dbl> 1098.260, 8572.130, 1115.715, 8568.120, 1129.366...
And it seems we are not fairing very well, although renewables is increasing the total primary energy is still way ahead and growing at a similar rate. At least up until 2015. You also have to remember that the “renewables” name in this case also includes (tragically in my opinion) biomass primary energy. We’ll look at that afterwards.
yearly_energy_summary %>%
ggplot(aes(year, total_mtoe, group = energy_source,
colour = energy_source)) +
geom_line(size = 1.2) +
blorg::blog_theme +
scale_color_manual(values = blorg::blog_palette)
Rarely does the renewables growth eclipse the total growth, although it is improving in more recent years.
yearly_energy_summary %>%
ggplot(aes(year, abs_growth, group = energy_source,
colour = energy_source)) +
geom_line(size = 1.2) +
blorg::blog_theme +
scale_color_manual(values = blorg::blog_palette)
As I mentioned previously, the drawback with the way the OECD calculates renewable primary energy, is that it includes biomass which really skews the measure. Let’s look at the countries with the most renewable primary energy as a proportion of their total.
primary_energy_enriched %>%
filter(year == 2015) %>%
select(-growth, -abs_growth) %>%
spread(energy_source, mtoe) %>%
mutate(renewables_percentage = (100 * renewables_mtoe) / total_mtoe) %>%
arrange(desc(renewables_percentage)) %>%
top_n(10, renewables_percentage) %>%
knitr::kable(caption = "Primary Renewable Energy as % of Total Primary Energy")
| year | country | renewables_mtoe | total_mtoe | renewables_percentage |
|---|---|---|---|---|
| 2015 | Paraguay | 7.041407 | 5.41 | 130.15540 |
| 2015 | Congo (Democratic Republic of the) | 28.018728 | 28.89 | 96.98417 |
| 2015 | Ethiopia | 46.710188 | 49.99 | 93.43906 |
| 2015 | Zambia | 9.111545 | 10.24 | 88.97993 |
| 2015 | Iceland | 4.930217 | 5.58 | 88.35514 |
| 2015 | Tanzania, United Republic of | 21.984053 | 25.97 | 84.65173 |
| 2015 | Nepal | 9.828948 | 11.69 | 84.07997 |
| 2015 | Mozambique | 10.728980 | 12.95 | 82.84927 |
| 2015 | Kenya | 20.389034 | 25.10 | 81.23121 |
| 2015 | Nigeria | 112.058201 | 139.37 | 80.40339 |
It’s a complete mixed bag in regards impact on climate, Paraguay exports huge amounts of hydroelectric power, and Iceland does well because of geothermal energy while basket-case countries like the Congo and not exactly great examples of sustainable growth. The use of renewables here, as defined by the OECD, is largely driven by poverty rather than any advancement in renewable technologies.
I’m really very pessimistic after looking at this data. Even when we factor in the use of biomass in renewables, which I would consider a dirty energy source, it seems renewables are not catching up with total primary energy (at least up to 2015). Unless things change very quickly, and exponential effects take over (as Elon Must often proposes) we are not going to switch our economies to sustainable energy production in any sort of acceptable timescale by way of “new renewable” technolgoies.
A work by Cormac Nolan
cormac.nolan85@gmail.com