Skip to content

Commit

Permalink
fix bug in convertGEA2012
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Sep 9, 2024
1 parent c5f8d78 commit 6ba9f01
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/convertGEA2012.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ convertGEA2012 <- function(x, subtype) {

if (subtype %in% c("oil", "coal", "gas")) {

# a hack: we must reformat the subdimension 'grade' so that its values are not
# integers, which causes the internal conversion back to maglass to wrongly guess
# the year dimension

getNames(out, dim = 4) <- paste0(getNames(out, dim = 4), "-grade")

# convert T US$2005/TWa -> T US$2017/TWa for cost factors xi1 and xi2
tmp <- GDPuc::convertGDP(
gdp = out[, , c("xi1", "xi2")],
Expand All @@ -68,6 +74,9 @@ convertGEA2012 <- function(x, subtype) {

out <- mbind(tmp, out[, , c("xi1", "xi2"), invert = TRUE])

# undo the hack after conversion
getNames(out, dim = 4) <- gsub("-grade", "", getNames(x, dim = 4))

} else {
out <- x
}
Expand Down

0 comments on commit 6ba9f01

Please sign in to comment.