From 0b700a6fc52d0b6c13abe4c73c4dad9b81bf936e Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Wed, 24 Jun 2026 10:55:45 +0200 Subject: [PATCH 1/2] read in latest IEA data --- .lintr | 2 +- R/convertIEA.R | 124 ++++++++++++---- R/readIEA.R | 132 +++++++++++++----- inst/extdata/sectoral/ieaShortNameMapping.csv | 76 ++++++++++ 4 files changed, 277 insertions(+), 57 deletions(-) create mode 100644 inst/extdata/sectoral/ieaShortNameMapping.csv diff --git a/.lintr b/.lintr index c02af8f2..91994cd8 100644 --- a/.lintr +++ b/.lintr @@ -1,2 +1,2 @@ -linters: lucode2::lintrRules() +linters: lucode2::lintrRules(modification = list(pipe_consistency_linter = pipe_consistency_linter(pipe = c("auto")))) encoding: "UTF-8" diff --git a/R/convertIEA.R b/R/convertIEA.R index 0e72f607..9d869591 100644 --- a/R/convertIEA.R +++ b/R/convertIEA.R @@ -12,16 +12,73 @@ #' @importFrom tidyr unite #' convertIEA <- function(x, subtype) { + if (subtype == "EnergyBalances-2026") { + stop("convert = T not supported for this subtype") + } + + if (subtype == "EnergyBalances-latest") { + + # map to old product and flow names + # this will be removed once we completely switch to the new format and adjust + # all the IEA mappings accordingly + + ieaShortNameMapping <- toolGetMapping("ieaShortNameMapping.csv", type = "sectoral", where = "mrcommons") + + flowMap <- ieaShortNameMapping %>% + filter(.data$type == "FLOW") %>% + select(-"type") + + flowMap <- rbind( + flowMap, + data.frame( + old_name = setdiff(getNames(x, dim = 2), flowMap$new_name), + new_name = setdiff(getNames(x, dim = 2), flowMap$new_name) + ) + ) + + flowMap <- arrange(flowMap, .data$new_name) + + getNames(x, dim = 2) <- flowMap[, "old_name"] + + productMap <- ieaShortNameMapping %>% + filter(.data$type == "PRODUCT") %>% + select(-"type") + + + productMap <- rbind( + productMap, + data.frame( + old_name = setdiff(getNames(x, dim = 1), productMap$new_name), + new_name = setdiff(getNames(x, dim = 1), productMap$new_name) + ) + ) + + productMap <- arrange(productMap, .data$new_name) + + getNames(x, dim = 1) <- productMap[, "old_name"] + } + if (grepl("EnergyBalances", subtype)) { + # remove GLO + x <- x["GLO", , , invert = TRUE] + # aggregate Kosovo to Serbia x1 <- x["KOS", , ] - getItems(x1, dim = 1) <- c("SRB") + getItems(x1, dim = 1) <- "SRB" x["SRB", , ] <- x["SRB", , ] + x1 - x <- x[c("KOS"), , , invert = TRUE] - - # convert electricity outputs (unit conversion between ktoe and GWh) - x[, , c("ELOUTPUT", "ELMAINE", "ELAUTOE", "ELMAINC", "ELAUTOC")] <- 0.0859845 * - x[, , c("ELOUTPUT", "ELMAINE", "ELAUTOE", "ELMAINC", "ELAUTOC")] + x <- x["KOS", , , invert = TRUE] + + if (subtype == "EnergyBalances") { + # convert electricity outputs (unit conversion between ktoe and GWh, not + # needed in 2025 edition of data) + x[, , c("ELOUTPUT", "ELMAINE", "ELAUTOE", "ELMAINC", "ELAUTOC")] <- 0.0859845 * + x[, , c("ELOUTPUT", "ELMAINE", "ELAUTOE", "ELMAINC", "ELAUTOC")] + } else if (subtype == "EnergyBalances-latest") { + # just drop unit dimension, as all values are already in intended unit: + # GWh for "ELOUTPUT", "ELMAINE", "ELAUTOE", "ELMAINC", "ELAUTOC" and ktoe for + # everything else + x <- magclass::collapseDim(x, dim = 3.3) + } # calculate weight to be used for regional disaggregations wp <- calcOutput("Population", scenario = "SSP2", aggregate = FALSE)[, 2010, ] @@ -30,29 +87,48 @@ convertIEA <- function(x, subtype) { wg <- wg / max(wg) w <- wp + wg - # disaggregating Other Africa (IAF), - # Other non-OECD Americas (ILA) and - # Other non-OECD Asia (IAS) regions to countries + # disaggregating regions + # - Other Africa (IAF) + # - Other non-OECD Americas (ILA) + # - Other non-OECD Asia (IAS) + mappingfile <- toolGetMapping( type = "regional", name = "regionmappingIeaOther2016.csv", returnPathOnly = TRUE, where = "mrcommons" ) + mapping <- read.csv2(mappingfile, stringsAsFactors = TRUE) %>% - filter(!(!!sym("CountryCode") %in% getItems(x, dim = 1))) - xadd <- toolAggregate(x[levels(mapping[[2]]), , ], mapping, weight = w[as.vector(mapping[[1]]), , ]) - x <- x[setdiff(getItems(x, dim = 1), as.vector(unique(mapping[[2]]))), , ] + filter(!(.data$CountryCode %in% getItems(x, dim = 1))) + + xadd <- toolAggregate( + x = x[unique(mapping$RegionCode), , ], + rel = mapping, + weight = w[unique(mapping$CountryCode), , ] + ) + x <- x[unique(mapping$RegionCode), , , invert = TRUE] x <- mbind(x, xadd) - # disaggregating extinct countries USSR (SUN) and Yugoslavia (YUG) - ISOhistorical <- read.csv2(system.file("extdata", "ISOhistorical.csv", package = "madrat"), stringsAsFactors = FALSE) # nolint - ISOhistorical <- ISOhistorical[!ISOhistorical$toISO == "SCG", ] # nolint - x <- toolISOhistorical(x, - mapping = ISOhistorical, - additional_weight = w[ISOhistorical[ISOhistorical$fromISO %in% c("YUG", "SUN"), "toISO"], , ] + # disaggregating extinct countries USSR (SUN) and Yugoslavia (YUG) ---- + + yugoslavia <- data.frame( + fromISO = "YUG", + toISO = c("SRB", "MNE", "SVN", "HRV", "MKD", "BIH"), + lastYear = "y1989" + ) + + sun <- toolGetMapping("ISOhistorical.csv", where = "madrat") %>% + filter(.data$fromISO == "SUN") %>% + mutate("lastYear" = "y1989") + + histMap <- rbind(yugoslavia, sun) + + x <- madrat::toolISOhistorical(x, + mapping = histMap, overwrite = TRUE, + additional_weight = w[unique(histMap$toISO), , ] ) x[is.na(x)] <- 0 - # filling missing country data + # filling missing country data ---- x <- toolCountryFill(x, 0, verbosity = 2) # These changes may reduce the amount of CHP plants to below what is actually @@ -79,9 +155,9 @@ convertIEA <- function(x, subtype) { x <- add_columns(x, addnm = missingFlows, dim = 3, fill = 0) d <- x[, , c("ELMAINE", "ELMAINC", "HEMAINC")] - tmp <- mcalc(d, ELMAINE ~ ifelse(HEMAINC > 0, ELMAINE, ELMAINC + ELMAINE), append = FALSE) + tmp <- magclass::mcalc(d, ELMAINE ~ ifelse(HEMAINC > 0, ELMAINE, ELMAINC + ELMAINE), append = FALSE) x[, , "ELMAINE"] <- tmp - tmp <- mcalc(d, ELMAINC ~ ifelse(HEMAINC > 0, ELMAINC, 0), append = FALSE) + tmp <- magclass::mcalc(d, ELMAINC ~ ifelse(HEMAINC > 0, ELMAINC, 0), append = FALSE) x[, , "ELMAINC"] <- tmp # for each product: check if the flow "HEAUTOC" > 0, if yes, do nothing; @@ -100,9 +176,9 @@ convertIEA <- function(x, subtype) { x <- add_columns(x, addnm = missingFlows, dim = 3, fill = 0) d <- x[, , c("ELAUTOE", "HEAUTOC", "ELAUTOC")] - tmp <- mcalc(d, ELAUTOE ~ ifelse(HEAUTOC > 0, ELAUTOE, ELAUTOC + ELAUTOE), append = FALSE) + tmp <- magclass::mcalc(d, ELAUTOE ~ ifelse(HEAUTOC > 0, ELAUTOE, ELAUTOC + ELAUTOE), append = FALSE) x[, , "ELAUTOE"] <- tmp - tmp <- mcalc(d, ELAUTOC ~ ifelse(HEAUTOC > 0, ELAUTOC, 0), append = FALSE) + tmp <- magclass::mcalc(d, ELAUTOC ~ ifelse(HEAUTOC > 0, ELAUTOC, 0), append = FALSE) x[, , "ELAUTOC"] <- tmp @@ -112,7 +188,7 @@ convertIEA <- function(x, subtype) { # in 2005 as there is no MARBUNK demand at all for REF regions. x["RUS", seq(1990, 2010, 1), "NONBIODIES.MARBUNK"] <- - x["RUS", c(1990, 2010), "NONBIODIES.MARBUNK"] |> time_interpolate(seq(1990, 2010, 1)) + x["RUS", c(1990, 2010), "NONBIODIES.MARBUNK"] %>% time_interpolate(seq(1990, 2010, 1)) # Adjust totals x["RUS", seq(1991, 2009, 1), "TOTAL.MARBUNK"] <- diff --git a/R/readIEA.R b/R/readIEA.R index 410886d1..14afbac4 100644 --- a/R/readIEA.R +++ b/R/readIEA.R @@ -5,35 +5,17 @@ #' @param subtype data subtype. Either "EnergyBalances", "EnergyBalances-latest", or "Emissions". #' - "EnergyBalances": IEA energy balances until 2022 (2023 incomplete), data updated in Sep 2024, #' the current default for REMIND input data -#' - "EnergyBalances-latest": IEA energy balances until 2022 (2023 incomplete), data updated in Sep 2024, -#' currently same as default +#' - "EnergyBalances-latest": IEA energy balances until 2023 (2024 incomplete), data updated in Aug 2025, +#' - "EnergyBalances-2026": incomplete IEA energy balances update from Apr 2026, #' @return magpie object of the IEA #' @author Anastasis Giannousakis, Lavinia Baumstark, Renato Rodrigues, Falk Benke -#' @seealso [madrat::readSource()] -#' @examples -#' \dontrun{ -#' a <- readSource(type = "IEA", subtype = "EnergyBalances") -#' } -#' -#' @importFrom data.table fread := -#' @importFrom dplyr %>% -#' @importFrom madrat toolCountry2isocode #' readIEA <- function(subtype) { + if (subtype == "EnergyBalances") { + energyBalancesFile <- "IEA-Energy-Balances-2024/worldbig.csv" + incomplete <- 2023 - if (grepl("EnergyBalances", subtype)) { - - if (subtype == "EnergyBalances") { - energyBalancesFile <- "IEA-Energy-Balances-2024/worldbig.csv" - incomplete <- 2023 - } else if (subtype == "EnergyBalances-latest") { - energyBalancesFile <- "IEA-Energy-Balances-2024/worldbig.csv" - incomplete <- 2023 - } else { - stop("Invalid subtype!") - } - - data <- fread( + data <- data.table::fread( file = energyBalancesFile, col.names = c("COUNTRY", "PRODUCT", "FLOW", "TIME", "ktoe"), colClasses = c("character", "character", "character", "numeric", "character"), @@ -43,13 +25,100 @@ readIEA <- function(subtype) { data$COUNTRY <- toolCountry2isocode(data$COUNTRY, warn = FALSE) data <- data %>% - filter(!is.na(!!sym("ktoe")), - !is.na(!!sym("COUNTRY")), - !!sym("TIME") != incomplete) %>% # exclude latest year with incomplete data - mutate(!!sym("ktoe") := as.numeric(!!sym("ktoe"))) + filter( + !is.na(.data$ktoe), + !is.na(.data$COUNTRY), + .data$TIME != incomplete + ) %>% # exclude latest year with incomplete data + mutate("ktoe" = as.numeric(.data$ktoe)) + + mdata <- as.magpie(data, + datacol = dim(data)[2], spatial = which(colnames(data) == "COUNTRY"), + temporal = which(colnames(data) == "TIME") + ) + } else if (subtype == "EnergyBalances-latest") { + data <- NULL + incomplete <- 2024 + + for (i in seq(1, 3)) { + energyBalancesFile <- file.path("IEA-Energy-Balances-2025", paste0("WBIG", i, ".zip")) + + tmp <- data.table::fread( + file = energyBalancesFile, + col.names = c("COUNTRY", "PRODUCT", "FLOW", "TIME", "UNIT", "VALUE"), + stringsAsFactors = FALSE, + na.strings = c("x", "..", "c", ""), + skip = 0, + showProgress = FALSE, + select = c(1, 2, 4, 3, 5, 6) + ) %>% + filter( + .data$UNIT %in% c("KTOE", "GWH"), + .data$TIME != incomplete # exclude latest year with incomplete data + ) %>% + mutate("VALUE" = as.numeric(.data$VALUE)) + + + tmp$COUNTRY <- toolCountry2isocode(tmp$COUNTRY, warn = TRUE, mapping = c( + "BURKINAFASO" = "BFA", + "CONGO_DRC" = "COD", + "CONGO_REPUB" = "COG", + "DOMINICANREP" = "DOM", + "NEWZEALAND" = "NZL", + "SAUDIARABIA" = "SAU", + "SOUTHAFRICA" = "ZAF", + "WORLD" = "GLO", + "F_USSR" = "SUN", + "F_YUGOSLAVIA" = "YUG", + "OTH_NON_OECDAFR" = "IAF", + "OTH_NON_OECDAM" = "ILA", + "OTH_NON_OECDAO" = "IAS" + )) - mdata <- as.magpie(data, datacol = dim(data)[2], spatial = which(colnames(data) == "COUNTRY"), - temporal = which(colnames(data) == "TIME")) + tmp <- tmp %>% + filter(!is.na(.data$COUNTRY), !is.na(.data$VALUE)) + + data <- rbind(data, tmp) + rm(tmp) + } + + mdata <- as.magpie(data, spatial = 1, temporal = 4, datacol = 6) + + } else if (subtype == "EnergyBalances-2026") { + data <- NULL + incomplete <- 2025 + + files <- list.files("IEA-Energy-Balances-2026-Apr", pattern = "*.csv", full.names = TRUE) + + for (f in files) { + tmp <- data.table::fread( + file = f, + select = c(3, 7, 5, 11, 17, 15), + col.names = c("COUNTRY", "PRODUCT", "FLOW", "TIME", "UNIT", "VALUE"), + na.strings = c("x", "..", "c", ""), + skip = 0, + showProgress = FALSE + ) %>% + filter( + .data$UNIT %in% c("KTOE", "GWH"), + .data$TIME != incomplete # exclude latest year with incomplete data + ) %>% + mutate("VALUE" = as.numeric(.data$VALUE)) + + tmp$COUNTRY <- madrat::toolCountry2isocode(tmp$COUNTRY, + warn = TRUE, + mapping = c( + "NEWZEALAND" = "NZL", + "SOUTHAFRICA" = "ZAF" + ) + ) + tmp <- tmp %>% + filter(!is.na(.data$COUNTRY), !is.na(.data$VALUE)) + data <- rbind(data, tmp) + rm(tmp) + } + + mdata <- as.magpie(data, spatial = 1, temporal = 4, datacol = 6) } else if (subtype == "Emissions") { data <- read.csv("emissions2013.csv") @@ -59,9 +128,8 @@ readIEA <- function(subtype) { if (names(data)[[5]] == "MtCO2") data <- data[!is.na(data$MtCO2), ] if (names(data)[[5]] == "MtCO2") data$MtCO2 <- suppressWarnings(as.numeric(data$MtCO2)) # nolint mdata <- as.magpie(data, datacol = dim(data)[2]) - } else { stop("Invalid subtype!") } - return(mdata) + return(magclass::magpiesort(mdata)) } diff --git a/inst/extdata/sectoral/ieaShortNameMapping.csv b/inst/extdata/sectoral/ieaShortNameMapping.csv new file mode 100644 index 00000000..da73f7ff --- /dev/null +++ b/inst/extdata/sectoral/ieaShortNameMapping.csv @@ -0,0 +1,76 @@ +type;old_name;new_name +PRODUCT;HARDCOAL;HARDCOAL_ND +PRODUCT;BROWN;BROWNCOAL_ND +PRODUCT;ANTCOAL;ANTHRACITE +PRODUCT;COKCOAL;COKING_COAL +PRODUCT;BITCOAL;OTH_BITCOAL +PRODUCT;OVENCOKE;COKE_OVEN_COKE_OTH +PRODUCT;BLFURGS;BLAST_FURNACE_GAS +PRODUCT;PRIMSBIO;PRIMARY_SOLID_BIOFUEL +PRODUCT;NATGAS;NATURAL_GAS +PRODUCT;CRUDEOIL;CRUDE_OIL +PRODUCT;NONCRUDE;OIL_PRIM_PRODUCTS_ND +PRODUCT;REFINGAS;REFINERY_GAS +PRODUCT;NONBIOGASO;MOTOR_GASOLINE_NONBIO +PRODUCT;NONBIOJETK;KEROSENE_JET_NONBIO +PRODUCT;OTHKERO;KEROSENE_OTHER +PRODUCT;NONBIODIES;GAS_DIESEL_OIL_NONBIO +PRODUCT;RESFUEL;FUEL_OIL_RESIDUAL +PRODUCT;WHITESP;WHITE_SPIRIT +PRODUCT;LUBRIC;LUBRICANTS +PRODUCT;PETCOKE;PETROLEUM_COKE +PRODUCT;ONONSPEC;OTH_SEC_OIL_PRODS_ND +PRODUCT;SOLARPV;SOLAR_PV +PRODUCT;SOLARTH;SOLAR_THERMAL +PRODUCT;ELECTR;ELECTRICITY +PRODUCT;MRENEW;RENEWABLES_TOTAL +PRODUCT;GASWKSGS;GASWORKS_GAS +PRODUCT;COKEOVGS;COKE_OVEN_GAS +PRODUCT;REFFEEDS;REFINERY_FEEDSTOCKS +PRODUCT;ADDITIVE;ADDITIVES +PRODUCT;AVGAS;AVIATION_GASOLINE +PRODUCT;COALTAR;COAL_TAR +PRODUCT;BIOGASOL;BIOGASOLINE +PRODUCT;PARWAX;PARAFFIN_WAXES +PRODUCT;PATFUEL;PATENT_FUEL +PRODUCT;JETGAS;GASOLINE_JET +PRODUCT;SUBCOAL;SUB_BITCOAL +PRODUCT;GASCOKE;GAS_COKE +PRODUCT;MANGAS;MANUFACTURED_GAS_OUTPUT +PRODUCT;INDWASTE;WASTE_INDUSTRIAL_NONREN +PRODUCT;RENEWNS;OTH_ENSOURC +PRODUCT;CRNGFEED;HYDROCARBONS_OTHER +PRODUCT;GEOTHERM;GEOTHERMAL +PRODUCT;OGASES;OTH_RECOVGASES +PRODUCT;MUNWASTER;WASTE_MUNICIPAL_REN +PRODUCT;MUNWASTEN;WASTE_MUNICIPAL_NONREN +PRODUCT;OBIOLIQ;LIQBIOFUEL_OTHER +PRODUCT;HEATNS;HEAT_COMBUSTIBLES_NS +PRODUCT;PEATPROD;PEAT_PRODUCTS +PRODUCT;OILSHALE;OIL_SHALE +PRODUCT;TIDE;TIDAL_WAVE_OCEAN +PRODUCT;BIOJETKERO;KEROSENE_JET_BIO +PRODUCT;OTHER;BIOFUEL_NONSPEC +FLOW;STOCKCHA;STCHANAT +FLOW;AGRICULT;AGRI_FOREST +FLOW;AVBUNK;BUNKERS_AVIATION +FLOW;MARBUNK;BUNKERS_MARINE +FLOW;TRANSFER;TRANSFERS +FLOW;NECHEM;NE_CHEM +FLOW;NECONSTRUC;NE_CONSTRUC +FLOW;NEFOODPRO;NE_FOODPRO +FLOW;NEIND;NE_IND +FLOW;NEINTREN;NE_IND_TRANSF +FLOW;NEINONSPEC;NE_INONSPEC +FLOW;NEIRONSTL;NE_IRONSTL +FLOW;NEMACHINE;NE_MACHINE +FLOW;NEMINING;NE_MINING +FLOW;NENONFERR;NE_NONFERR +FLOW;NENONMET;NE_NONMET +FLOW;NEOTHER;NE_OTHER +FLOW;NEPAPERPRO;NE_PAPERPRO +FLOW;NETEXTILES;NE_TEXTILES +FLOW;NEWOODPRO;NE_WOODPRO +FLOW;NETRANS;NE_TRANS +FLOW;NETRANSEQ;NE_TRANSEQ +FLOW;NONENUSE;NE_TOT From 1cdc0548236e2f1a1d5f4bd7b8fbc592007d37f8 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Wed, 24 Jun 2026 14:09:13 +0200 Subject: [PATCH 2/2] increment version --- .buildlibrary | 2 +- .github/workflows/pkgdown.yaml | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- NAMESPACE | 1 - R/convertIEA.R | 4 ++-- R/readIEA.R | 2 +- README.md | 8 ++++---- ...calcAtmosphericTransboundaryRedepositionShare.Rd | 3 ++- man/calcClimateClass.Rd | 6 ++++-- man/calcDevelopmentState.Rd | 2 +- man/convertJRC_IDEES.Rd | 4 ++-- man/mrcommons-package.Rd | 1 + man/readIEA.Rd | 13 ++----------- man/readJRC_IDEES.Rd | 2 +- 15 files changed, 26 insertions(+), 32 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 0492e300..1c7ced1e 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '34918422' +ValidationKey: '34964460' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index ec2d3cb7..d62e0501 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -28,7 +28,7 @@ jobs: run: | options(repos = c(pikpiam = 'https://pik-piam.r-universe.dev', CRAN = Sys.getenv('RSPM'))) - pak::pak(".") + pak::pak(".", dependencies = 'all') pak::pkg_install("tidyverse/tidytemplate") - name: Build site diff --git a/CITATION.cff b/CITATION.cff index ea978351..8a49452f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'mrcommons: MadRat commons Input Data Library' -version: 1.69.4 -date-released: '2026-06-09' +version: 1.69.5 +date-released: '2026-06-24' abstract: Provides useful functions and a common structure to all the input data required to run models like MAgPIE and REMIND of model input data. authors: diff --git a/DESCRIPTION b/DESCRIPTION index f2f768d8..c1efd73c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrcommons Title: MadRat commons Input Data Library -Version: 1.69.4 -Date: 2026-06-09 +Version: 1.69.5 +Date: 2026-06-24 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), diff --git a/NAMESPACE b/NAMESPACE index 6c1701a0..8be1d8ca 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,7 +36,6 @@ import(mrfaocore) import(mrlandcore) import(mstools) importFrom(countrycode,countrycode) -importFrom(data.table,":=") importFrom(data.table,as.data.table) importFrom(data.table,fread) importFrom(dplyr,"%>%") diff --git a/R/convertIEA.R b/R/convertIEA.R index 9d869591..26b5b8b4 100644 --- a/R/convertIEA.R +++ b/R/convertIEA.R @@ -18,6 +18,8 @@ convertIEA <- function(x, subtype) { if (subtype == "EnergyBalances-latest") { + x <- x["GLO", , , invert = TRUE] + # map to old product and flow names # this will be removed once we completely switch to the new format and adjust # all the IEA mappings accordingly @@ -59,8 +61,6 @@ convertIEA <- function(x, subtype) { } if (grepl("EnergyBalances", subtype)) { - # remove GLO - x <- x["GLO", , , invert = TRUE] # aggregate Kosovo to Serbia x1 <- x["KOS", , ] diff --git a/R/readIEA.R b/R/readIEA.R index 14afbac4..69e167df 100644 --- a/R/readIEA.R +++ b/R/readIEA.R @@ -59,7 +59,7 @@ readIEA <- function(subtype) { mutate("VALUE" = as.numeric(.data$VALUE)) - tmp$COUNTRY <- toolCountry2isocode(tmp$COUNTRY, warn = TRUE, mapping = c( + tmp$COUNTRY <- toolCountry2isocode(tmp$COUNTRY, warn = FALSE, mapping = c( "BURKINAFASO" = "BFA", "CONGO_DRC" = "COD", "CONGO_REPUB" = "COG", diff --git a/README.md b/README.md index a8dde01d..257b57ad 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat commons Input Data Library -R package **mrcommons**, version **1.69.4** +R package **mrcommons**, version **1.69.5** [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3822009.svg)](https://doi.org/10.5281/zenodo.3822009) [![R build status](https://github.com/pik-piam/mrcommons/workflows/check/badge.svg)](https://github.com/pik-piam/mrcommons/actions) [![codecov](https://codecov.io/gh/pik-piam/mrcommons/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrcommons) [![r-universe](https://pik-piam.r-universe.dev/badges/mrcommons)](https://pik-piam.r-universe.dev/builds) @@ -40,7 +40,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , Version: 1.69.4, . +Bodirsky B, Karstens K, Baumstark L, Weindl I, Wang X, Mishra A, Wirth S, Stevanovic M, Steinmetz N, Kreidenweis U, Rodrigues R, Popov R, Humpenoeder F, Giannousakis A, Levesque A, Klein D, Araujo E, Bleidorn E, Beier F, Oeser J, Pehl M, Leip D, Crawford M, Molina Bacca E, von Jeetze P, Martinelli E, Schreyer F, Soergel B, Sauer P, Hötten D, Hasse R, Abrahão G, Weigmann P, Dietrich J (2026). "mrcommons: MadRat commons Input Data Library." doi:10.5281/zenodo.3822009 , Version: 1.69.5, . A BibTeX entry for LaTeX users is @@ -49,9 +49,9 @@ A BibTeX entry for LaTeX users is title = {mrcommons: MadRat commons Input Data Library}, author = {Benjamin Leon Bodirsky and Kristine Karstens and Lavinia Baumstark and Isabelle Weindl and Xiaoxi Wang and Abhijeet Mishra and Stephen Wirth and Mishko Stevanovic and Nele Steinmetz and Ulrich Kreidenweis and Renato Rodrigues and Roman Popov and Florian Humpenoeder and Anastasis Giannousakis and Antoine Levesque and David Klein and Ewerton Araujo and Eva Bleidorn and Felicitas Beier and Julian Oeser and Michaja Pehl and Debbora Leip and Michael Crawford and Edna {Molina Bacca} and Patrick {von Jeetze} and Eleonora Martinelli and Felix Schreyer and Bjoern Soergel and Pascal Sauer and David Hötten and Robin Hasse and Gabriel Abrahão and Pascal Weigmann and Jan Philipp Dietrich}, doi = {10.5281/zenodo.3822009}, - date = {2026-06-09}, + date = {2026-06-24}, year = {2026}, url = {https://github.com/pik-piam/mrcommons}, - note = {Version: 1.69.4}, + note = {Version: 1.69.5}, } ``` diff --git a/man/calcAtmosphericTransboundaryRedepositionShare.Rd b/man/calcAtmosphericTransboundaryRedepositionShare.Rd index 9032549d..4634cd9e 100644 --- a/man/calcAtmosphericTransboundaryRedepositionShare.Rd +++ b/man/calcAtmosphericTransboundaryRedepositionShare.Rd @@ -1,5 +1,6 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calcAtmosphericTransboundaryRedepositionShare.R +% Please edit documentation in +% R/calcAtmosphericTransboundaryRedepositionShare.R \name{calcAtmosphericTransboundaryRedepositionShare} \alias{calcAtmosphericTransboundaryRedepositionShare} \title{calcAtmosphericRedepositionShare} diff --git a/man/calcClimateClass.Rd b/man/calcClimateClass.Rd index dec4dc73..20f8d98a 100644 --- a/man/calcClimateClass.Rd +++ b/man/calcClimateClass.Rd @@ -8,9 +8,11 @@ calcClimateClass(datasource = "koeppen") } \arguments{ \item{datasource}{select source from: -- koeppen for Koeppen Geiger Classification +\itemize{ +\item koeppen for Koeppen Geiger Classification http://koeppen-geiger.vu-wien.ac.at/ -- ipcc, ipccReduced, ipccReduced2019 for IPCC Guideline climate classification} +\item ipcc, ipccReduced, ipccReduced2019 for IPCC Guideline climate classification +}} } \value{ Clustered MAgPIE object on requested resolution diff --git a/man/calcDevelopmentState.Rd b/man/calcDevelopmentState.Rd index 45e8758a..0158748c 100644 --- a/man/calcDevelopmentState.Rd +++ b/man/calcDevelopmentState.Rd @@ -27,7 +27,7 @@ calcOutput("DevelopmentState") } \seealso{ -\code{\link[mrdrivers:calcGDP]{mrdrivers::calcGDPpc()}} +\code{\link[mrdrivers:calcGDPpc]{mrdrivers::calcGDPpc()}} } \author{ Benjamin Leon Bodirsky, Kristine Karstens diff --git a/man/convertJRC_IDEES.Rd b/man/convertJRC_IDEES.Rd index d1ec094a..6b0ed692 100644 --- a/man/convertJRC_IDEES.Rd +++ b/man/convertJRC_IDEES.Rd @@ -7,13 +7,13 @@ convertJRC_IDEES(x, subtype) } \arguments{ -\item{x}{A \code{\link[magclass:magclass-package]{magpie}} object returned from +\item{x}{A \code{\link[magclass:magclass]{magpie}} object returned from \code{\link[=readJRC_IDEES]{readJRC_IDEES()}}.} \item{subtype}{character, subtype of \code{\link[=readJRC_IDEES]{readJRC_IDEES()}}} } \value{ -A \code{\link[magclass:magclass-package]{magpie}} object. +A \code{\link[magclass:magclass]{magpie}} object. } \description{ Missing data for EU-28 countries is added, by distributing the difference of diff --git a/man/mrcommons-package.Rd b/man/mrcommons-package.Rd index 8ad83920..1e88c42a 100644 --- a/man/mrcommons-package.Rd +++ b/man/mrcommons-package.Rd @@ -22,6 +22,7 @@ Useful links: Authors: \itemize{ + \item Jan Philipp Dietrich \email{dietrich@pik-potsdam.de} \item Benjamin Leon Bodirsky \email{bodirsky@pik-potsdam.de} \item Kristine Karstens \item Lavinia Baumstark diff --git a/man/readIEA.Rd b/man/readIEA.Rd index 0c60a151..dbaf7fa4 100644 --- a/man/readIEA.Rd +++ b/man/readIEA.Rd @@ -11,8 +11,8 @@ readIEA(subtype) \itemize{ \item "EnergyBalances": IEA energy balances until 2022 (2023 incomplete), data updated in Sep 2024, the current default for REMIND input data -\item "EnergyBalances-latest": IEA energy balances until 2022 (2023 incomplete), data updated in Sep 2024, -currently same as default +\item "EnergyBalances-latest": IEA energy balances until 2023 (2024 incomplete), data updated in Aug 2025, +\item "EnergyBalances-2026": incomplete IEA energy balances update from Apr 2026, }} } \value{ @@ -21,15 +21,6 @@ magpie object of the IEA \description{ Read-in an IEA csv file as magpie object } -\examples{ -\dontrun{ -a <- readSource(type = "IEA", subtype = "EnergyBalances") -} - -} -\seealso{ -\code{\link[madrat:readSource]{madrat::readSource()}} -} \author{ Anastasis Giannousakis, Lavinia Baumstark, Renato Rodrigues, Falk Benke } diff --git a/man/readJRC_IDEES.Rd b/man/readJRC_IDEES.Rd index bd725cc8..3fa0b618 100644 --- a/man/readJRC_IDEES.Rd +++ b/man/readJRC_IDEES.Rd @@ -21,7 +21,7 @@ sectors) }} } \value{ -A \code{\link[magclass:magclass-package]{magpie}} object. +A \code{\link[magclass:magclass]{magpie}} object. } \description{ Read the \href{https://data.jrc.ec.europa.eu/dataset/jrc-10110-10001/resource/f590b6f1-60e5-49a6-a972-60bc2b2e34b3}{IDEES data base from JRC} #nolint