fix_GHA_psb: Improve Ghana Primary solid biofuels data from 1991 through...

View source: R/fixes.R

fix_GHA_psbR Documentation

Improve Ghana Primary solid biofuels data from 1991 through 1999

Description

Ghana's Primary solid biofuels data show a very large and dramatic decline from 1999 to 2000. This decline is due to new survey data being used for the 2000 data. When we look at the PSB data on a per-capita basis, it is clear that a near-constant PSB/capita value was used to extrapolate per-capita usage in the late 1990s. When new survey data became available for the 2000 reporting year, the per-capita consumption of PSB obviously changed. Our approach to this problem is to smooth out the really big peak in PSB consumption by reducing the per-capita consumption of PSB, starting in 1991.

Usage

fix_GHA_psb(
  .tidy_iea_df,
  country = IEATools::iea_cols$country,
  year = IEATools::iea_cols$year,
  e_dot = IEATools::iea_cols$e_dot
)

Arguments

.tidy_iea_df

a tidy IEA data frame produced by load_tidy_iea_df()

country, year, e_dot

See IEATools::iea_cols.

Details

If .tidy_iea_df does not contain data from Ghana for the years in question, no fixing is performed, and .tidy_iea_df is returned unmodified.

See the Supplemental information to M. K. Heun and P. E. Brockway. Meeting 2030 primary energy and economic growth goals: Mission impossible? Applied Energy, 251(112697):1–24, May 2019 for additional details.

Also see the file named "GHA-PSB.xlsx" for the actual calculations.

Value

.tidy_iea_df with smoothed Ghana Primary solid biofuels data

Examples

library(dplyr)
# Build an example tidy IEA data frame in which Ghana's Primary solid biofuels can be fixed.
example_tidy_iea_df <- load_tidy_iea_df() %>% 
  filter(Country == "GHA") %>% 
  filter(Product == "Primary solid biofuels") %>% 
  # The example data frame has PSB for Ghana for 1971 and 2000.  
  # Let's pretend that 1971 is 1991 and 2000 is 1992.
  mutate(
    Year := dplyr::case_when(
      Year == 1971 ~ 1991,
      Year == 2000 ~ 1992
    )
  ) 
example_tidy_iea_df
fixed <- example_tidy_iea_df %>% 
  fix_GHA_psb()
# Compare production of Primary solid biofuels in 1991
example_tidy_iea_df %>% 
  filter(Year == 1991, Flow == "Production") %>% 
  select("E.dot", "Unit")
fixed %>% 
  filter(Year == 1991, Flow == "Production") %>% 
  select("E.dot", "Unit")

MatthewHeun/IEATools documentation built on Feb. 6, 2024, 3:29 p.m.