Skip to content

Commit

Permalink
filter IEA ETP production data the madrat way
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Sep 5, 2024
1 parent 59a634e commit 14fce4a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 83 deletions.
17 changes: 15 additions & 2 deletions R/calcIEA_ETP.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#' @export

calcIEA_ETP <- function() {

mapping <- toolGetMapping("Mapping_IEA_ETP.csv", type = "reportingVariables", where = "mrremind") %>%
filter(!is.na(!!sym("REMIND")), !!sym("REMIND") != "") %>%
mutate("Conversion" = as.numeric(!!sym("Conversion"))) %>%
Expand Down Expand Up @@ -52,11 +51,25 @@ calcIEA_ETP <- function() {
x <- aggregate(value ~ region + year + model + variable, x, sum, na.action = na.pass) %>%
as.magpie()

.customAggregate <- function(x, rel, to = NULL) {
out <- toolAggregate(x, rel = rel, to = to)

# remove cement and industry production for all regions except for GLO
if ("GLO" %in% getItems(out, dim = 1)) {
out[setdiff(getItems(out, dim = 1), "GLO"), ,
c("Production|Industry|Cement (Mt/yr)", "Production|Industry|Steel (Mt/yr)")] <- NA

} else {
out <- out[, , c("Production|Industry|Cement (Mt/yr)", "Production|Industry|Steel (Mt/yr)"), invert = TRUE]
}
return(out)
}

return(list(
x = x,
weight = NULL,
aggregationFunction = .customAggregate,
unit = c("EJ/yr", "Mt CO2/yr", "Mt/yr", "bn pkm/yr", "bn tkm/yr"),
description = "IEA ETP projections as REMIND variables"
))

}
71 changes: 0 additions & 71 deletions R/filter_historical_mif.R

This file was deleted.

3 changes: 0 additions & 3 deletions R/fullVALIDATIONREMIND.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,4 @@ fullVALIDATIONREMIND <- function(rev = 0) {
try = FALSE, years = years,
writeArgs = list(scenario = "historical", model = "INDSTAT2")
)

# filter variables that are too imprecise on regional level ----
filter_historical_mif()
}
7 changes: 0 additions & 7 deletions inst/extdata/historical_mif_filter_table.csv

This file was deleted.

0 comments on commit 14fce4a

Please sign in to comment.