R/convertBGR.R

Defines functions convertBGR

Documented in convertBGR

#' Converts BGR oil, gas, coal and uranium reserves data
#'
#' @param x MAgPIE object to be converted
#' @param subtype data subtype. Either "oil", "gas", "coal" or "uranium".
#' @return A MAgPIE object containing BGR (Federal Institute for Geosciences and
#' Natural Resources) country reserves disaggregated data of oil, gas, coal and uranium.
#' @author Renato Rodrigues
#' @examples
#' \dontrun{
#' a <- convertBGR(x, subtype = "oil")
#' }
#'
convertBGR <- function(x, subtype) {
  # rename countries to REMIND iso codes
  getItems(x, dim = 1) <- toolCountry2isocode(getItems(x, dim = 1))
  x[is.na(x)] <- 0 # setting NA values to zero
  x <- toolCountryFill(x, fill = 0, verbosity = 2) # fill countries with no data
  return(x)
}
pik-piam/mrremind documentation built on May 1, 2024, 2:12 a.m.