From 67e970b0f13cff9c802ad180c5b465092de66fa2 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Tue, 3 Sep 2024 17:23:13 +0200 Subject: [PATCH 1/2] update to 2017 values --- .buildlibrary | 2 +- CITATION.cff | 2 +- DESCRIPTION | 2 +- R/calcGTAPTotalTransportCosts.R | 4 +- R/calcIniFoodPrice.R | 27 +++++++- R/calcMAgPIEReport.R | 22 +++---- R/calcPriceAgriculture.R | 10 +-- R/calcWBGEM.R | 11 +++- R/convertGTAPv8v9.R | 5 +- R/convertICP2017.R | 24 ++++--- R/convertSSPResults.R | 110 +++++++++++++++++--------------- R/readIMPACT3.2.2World_Price.R | 9 +++ README.md | 6 +- man/calcIniFoodPrice.Rd | 2 +- man/calcPriceAgriculture.Rd | 2 +- man/convertICP2017.Rd | 2 +- 16 files changed, 145 insertions(+), 95 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 52657285..e0e2a20c 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '28575639' +ValidationKey: '28755360' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index e4cb8525..7d67045b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,7 +2,7 @@ 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.43.1 +version: 1.44.0 date-released: '2024-09-03' 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. diff --git a/DESCRIPTION b/DESCRIPTION index f1686fe9..7ad47ab6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrcommons Type: Package Title: MadRat commons Input Data Library -Version: 1.43.1 +Version: 1.44.0 Date: 2024-09-03 Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), diff --git a/R/calcGTAPTotalTransportCosts.R b/R/calcGTAPTotalTransportCosts.R index 6e7c8366..0d3b4d6d 100644 --- a/R/calcGTAPTotalTransportCosts.R +++ b/R/calcGTAPTotalTransportCosts.R @@ -47,11 +47,11 @@ calcGTAPTotalTransportCosts <- function(costType = "transport", version = "9") { totalTcosts <- (tcostInputs + tcostToSecondary) / 2 totalTcosts <- GDPuc::convertGDP(totalTcosts, unit_in = "current US$MER", - unit_out = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", replace_NAs = "no_conversion") return(list(x = totalTcosts, weight = NULL, - unit = "million constant 2005 US$MER/yr", + unit = "million constant 2017 US$MER/yr", description = "Costs for GTAP commodities (half of input to market and market to value")) } diff --git a/R/calcIniFoodPrice.R b/R/calcIniFoodPrice.R index d22b4dd7..9f628a40 100644 --- a/R/calcIniFoodPrice.R +++ b/R/calcIniFoodPrice.R @@ -9,7 +9,7 @@ #' @param year Specifies the year for the initialization of prices in MAgPIE. Default is `y2005`. #' @param products subselection of products to be returned #' -#' @return List with a magpie object with commodity prices on global level in $05/tDM. +#' @return List with a magpie object with commodity prices on global level in $17/tDM. #' @author Mishko Stevanovic, Benjamin Leon Bodirsky #' @seealso #' [readIMPACT3.2.2World_Price()] @@ -27,7 +27,7 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo dm <- collapseNames(dm) if (datasource == "IMPACT3.2.2World_Price") { - out <- readSource("IMPACT3.2.2World_Price") + out <- readSource("IMPACT3.2.2World_Price") # in 2017 prices now # select scenario and initial year out <- collapseNames(out[, year, "SSP2-NoCC-NoCC-379"]) out <- setYears(out, NULL) @@ -69,6 +69,17 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo out[, , "pasture"] <- 50 # quick google search out[, , "scp"] <- 1500 # using upper end prices similar to fishmeal + # [DC] At some point probably better to do another 'quick google search', + # for now convert these to 2017 values using US inflation, also for consistency + conv <- c("sugr_cane", "sugr_beet", "alcohol", "fish", "oilpalm", "oilcakes", "cottn_pro", "foddr", + "brans", "distillers_grain", "ethanol", "fibres", "molasses", "wood", "woodfuel", "begr", + "betr", "res_cereals", "res_fibrous", "pasture", "scp") + getItems(out, dim = 1) <- "USA" + out[, , conv] <- GDPuc::convertGDP(out[, , conv], unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getItems(out, dim = 1) <- "GLO" + # correct the prices for dry matter values out <- out[, , ] / dm[, , ] @@ -106,6 +117,16 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo out[, , "foddr"] <- 50 # quick google search out[, , "sugar"] <- 250 # quick google search + conv <- c("fish", "oilcakes", "brans", "distillers_grain", "ethanol", "alcohol", + "molasses", "wood", "woodfuel", "begr", + "betr", "res_cereals", "res_fibrous", "pasture", "scp", + "foddr", "sugar") + getItems(out, dim = 1) <- "USA" + out[, , conv] <- GDPuc::convertGDP(out[, , conv], unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getItems(out, dim = 1) <- "GLO" + # correct the prices from online sources for dry matter values out[, , missingCommodities] <- out[, , missingCommodities] / dm[, , missingCommodities] @@ -120,7 +141,7 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo return(list(x = out, weight = NULL, - unit = "US$05/tDM", + unit = "US$2017/tDM", description = description, isocountries = FALSE)) } diff --git a/R/calcMAgPIEReport.R b/R/calcMAgPIEReport.R index b0d17d6d..21930b9d 100644 --- a/R/calcMAgPIEReport.R +++ b/R/calcMAgPIEReport.R @@ -4,15 +4,15 @@ calcMAgPIEReport <- function(subtype) { x <- readSource("MAgPIE", subtype = "MAgPIEReport_extensive") if (subtype == "CostTotal") { - # with transformation factor from 10E6 US$2005 to 10E12 US$2005 - x <- x[, , "Costs Without Incentives (million US$05/yr)"] / 1000 / 1000 + # with transformation factor from 10E6 US$2017 to 10E12 US$2017 + x <- x[, , "Costs Without Incentives (million US$17/yr)"] / 1000 / 1000 d <- "Total Landuse Costs from MAgPIE excluding emission costs" - u <- "T$2005/yr" + u <- "T$2017/yr" } else if (subtype == "CostMAC") { - # with transformation factor from 10E6 US$2005 to 10E12 US$2005 - x <- x[, , "Costs Accounting|+|MACCS (million US$05/yr)"] / 1000 / 1000 + # with transformation factor from 10E6 US$2017 to 10E12 US$2017 + x <- x[, , "Costs Accounting|+|MACCS (million US$17/yr)"] / 1000 / 1000 d <- "MAC Costs for LU emissions from MAgPIE" - u <- "T$2005/yr" + u <- "T$2017/yr" } else if (subtype == "ProductionBiomass") { x <- x[, , "Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"] / 31.536 # EJ to TWa d <- "Production of ligno-cellulosic purpose grown biomass in MAgPIE" @@ -65,11 +65,11 @@ calcMAgPIEReport <- function(subtype) { getNames(x) <- getNames(x) %>% stringr::str_replace_all(c( "^C_" = "", - #"-PkBudg900-mag-4" = ".rcp20", # in 2022-10 still in emulator files - #"-PkBudg500-mag-4" = ".rcp20", # in 2023-10 still in emulator files + # "-PkBudg900-mag-4" = ".rcp20", # in 2022-10 still in emulator files + # "-PkBudg500-mag-4" = ".rcp20", # in 2023-10 still in emulator files "-PkBudg650-mag-4" = ".rcp20", - #"-PkBudg1300-mag-4" = ".rcp26", # in 2022-10 still in emulator files - #"-PkBudg1150-mag-4" = ".rcp26", # in 2023-10 still in emulator files + # "-PkBudg1300-mag-4" = ".rcp26", # in 2022-10 still in emulator files + # "-PkBudg1150-mag-4" = ".rcp26", # in 2023-10 still in emulator files "-PkBudg1050-mag-4" = ".rcp26", "-NDC-mag-4" = ".rcp45", "-Base-mag-4" = ".none", @@ -78,7 +78,7 @@ calcMAgPIEReport <- function(subtype) { )) # add values for SSP3 copying the values from SSP2 - tmp <- x[,,"SSP2"] + tmp <- x[, , "SSP2"] getNames(tmp) <- gsub("SSP2", "SSP3", getNames(tmp)) x <- mbind(x, tmp) diff --git a/R/calcPriceAgriculture.R b/R/calcPriceAgriculture.R index 73919ce7..1a404342 100644 --- a/R/calcPriceAgriculture.R +++ b/R/calcPriceAgriculture.R @@ -37,7 +37,7 @@ #' @importFrom reshape2 melt acast #' -calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = "US$05/tDM") { +calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = "US$17/tDM") { if (datasource == "IMPACT3.2.2World_Price") { @@ -70,7 +70,7 @@ calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = " } else if (datasource == "WBGEM") { - # Prices in US$05/tDM + # Prices in US$17/tDM x <- calcOutput("WBGEM", aggregate = FALSE) # sectoral mappings @@ -138,7 +138,7 @@ calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = " } else if (datasource == "FAO") { - # Annual producer prices in US$05/tDM + # Annual producer prices in US$17/tDM out <- readSource("FAO_online", subtype = "PricesProducerAnnual", convert = TRUE) aggregation <- toolGetMapping("FAOitems_online.csv", type = "sectoral", where = "mappingfolder") @@ -184,10 +184,10 @@ calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = " isocountries <- TRUE } - if (unit != "US$05/tDM") { + if (unit != "US$17/tDM") { # Transform to selected currency unit out <- GDPuc::convertGDP(out, - unit_in = "constant 2005 US$MER", + unit_in = "constant 2017 US$MER", unit_out = unit, replace_NAs = "no_conversion") } diff --git a/R/calcWBGEM.R b/R/calcWBGEM.R index 06cd6b92..1582aa94 100644 --- a/R/calcWBGEM.R +++ b/R/calcWBGEM.R @@ -21,7 +21,7 @@ calcWBGEM <- function() { setNames(x[, , grep("nominal", sugar, value = TRUE)], NULL), NULL) adjustFactor2005 <- 1 / setYears(x[, 2005, grep("real", sugar, value = TRUE)] / setNames(x[, 2005, grep("nominal", sugar, value = TRUE)], NULL), NULL) * - adjustFactor2010 + adjustFactor2010 adjustFactor2005 <- setNames(adjustFactor2005, NULL) vars <- grep("nominal", getNames(x), value = TRUE) @@ -45,8 +45,15 @@ calcWBGEM <- function() { out <- out * adjustFactor2005 out[is.na(out)] <- 0 + # inflate to 2017 using US inflation for global value + getItems(out, dim = 1) <- "USA" + out <- GDPuc::convertGDP(out, unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getItems(out, dim = 1) <- "GLO" + return(list(x = out, - unit = "real2005 USD per ton", + unit = "real2017 USD per ton", weight = NULL, description = "WBGEM global price of commodity")) } diff --git a/R/convertGTAPv8v9.R b/R/convertGTAPv8v9.R index 4d8f0795..05e90126 100644 --- a/R/convertGTAPv8v9.R +++ b/R/convertGTAPv8v9.R @@ -66,9 +66,10 @@ convertGTAPv8v9 <- function(x, subtype) { } else { gdpMer <- calcOutput("GDPPast", GDPPast = "WDI-MI", - unit = "constant 2005 US$MER", aggregate = FALSE) + unit = "constant 2017 US$MER", aggregate = FALSE) gdpMer <- gdpMer[, getYears(x), , drop = TRUE] - w1 <- GDPuc::convertGDP(gdpMer, unit_in = "constant 2005 US$MER", + w1 <- GDPuc::convertGDP(gdpMer, + unit_in = "constant 2017 US$MER", unit_out = "current US$MER", replace_NAs = "no_conversion") getNames(w1) <- NULL diff --git a/R/convertICP2017.R b/R/convertICP2017.R index 36d9da01..e26b69c0 100644 --- a/R/convertICP2017.R +++ b/R/convertICP2017.R @@ -1,7 +1,7 @@ #' @title convertICP2017 #' @description converts data of World Bank ICP round, downloaded from #' here: https://databank.worldbank.org/source/icp-2017 -#' mainly a currency conversion to MER05. Assume that in the original dataset, +#' mainly a currency conversion to MER2017. Assume that in the original dataset, #' 2011 values are in 2011MER and 2017 in 2017MER, given the ICP rounds #' #' @param subtype data subtype needed. Either "priceLevel", or "per_cap_exp" @@ -17,8 +17,10 @@ convertICP2017 <- function(x, subtype = "per_cap_expMER") { # currency convert for expenditures if (subtype == "per_cap_expMER") { - x2011 <- GDPuc::convertGDP(x[, 2011, ], unit_in = "constant 2011 US$MER", unit_out = "constant 2005 US$MER") - x2017 <- GDPuc::convertGDP(x[, 2017, ], unit_in = "constant 2017 US$MER", unit_out = "constant 2005 US$MER") + x2011 <- GDPuc::convertGDP(x[, 2011, ], + unit_in = "constant 2011 US$MER", + unit_out = "constant 2017 US$MER") + x2017 <- x[, 2017, ] x <- mbind(x2011, x2017) x[is.na(x)] <- 0 } @@ -26,8 +28,10 @@ convertICP2017 <- function(x, subtype = "per_cap_expMER") { # currency convert for expenditures if (subtype == "per_cap_expPPP") { - x2011 <- GDPuc::convertGDP(x[, 2011, ], unit_in = "constant 2011 US$PPP", unit_out = "constant 2005 US$MER") - x2017 <- GDPuc::convertGDP(x[, 2017, ], unit_in = "constant 2017 US$PPP", unit_out = "constant 2005 US$MER") + x2011 <- GDPuc::convertGDP(x[, 2011, ], + unit_in = "constant 2011 US$PPP", + unit_out = "constant 2017 US$MER") + x2017 <- x[, 2017, ] x <- mbind(x2011, x2017) x[is.na(x)] <- 0 } @@ -35,11 +39,11 @@ convertICP2017 <- function(x, subtype = "per_cap_expMER") { # remove aggregate categories x <- x[, , c("GROSS DOMESTIC PRODUCT", - "FOOD AND NON-ALCOHOLIC BEVERAGES", - "ALCOHOLIC BEVERAGES, TOBACCO AND NARCOTICS", - "HOUSEHOLDS AND NPISHS FINAL CONSUMPTION EXPENDITURE", - "INDIVIDUAL CONSUMPTION EXPENDITURE BY HOUSEHOLDS WITHOUT HOUSING", - "GENERAL GOVERNMENT FINAL CONSUMPTION EXPENDITURE"), invert = TRUE] + "FOOD AND NON-ALCOHOLIC BEVERAGES", + "ALCOHOLIC BEVERAGES, TOBACCO AND NARCOTICS", + "HOUSEHOLDS AND NPISHS FINAL CONSUMPTION EXPENDITURE", + "INDIVIDUAL CONSUMPTION EXPENDITURE BY HOUSEHOLDS WITHOUT HOUSING", + "GENERAL GOVERNMENT FINAL CONSUMPTION EXPENDITURE"), invert = TRUE] return(x) diff --git a/R/convertSSPResults.R b/R/convertSSPResults.R index c6a39bde..77aa5367 100644 --- a/R/convertSSPResults.R +++ b/R/convertSSPResults.R @@ -41,14 +41,14 @@ convertSSPResults <- function(x) { # ---- Land ---- - #nolint start + # nolint start selection <- c("Land Cover (million ha)", "Land Cover|Built-up Area (million ha)", "Land Cover|Cropland (million ha)", "Land Cover|Cropland|Energy Crops (million ha)", "Land Cover|Forest (million ha)", "Land Cover|Forest|Forestry (million ha)", "Land Cover|Forest|Forestry|Harvested Area (million ha)", "Land Cover|Forest|Natural Forest (million ha)", "Land Cover|Other Arable Land (million ha)", "Land Cover|Other Land (million ha)", "Land Cover|Other Natural Land (million ha)", "Land Cover|Pasture (million ha)") - #nolint end + # nolint end # use land area as weight weight <- setYears(dimSums(calcOutput("LanduseInitialisation", aggregate = FALSE), dim = 3)[, 2010, ], NULL) @@ -69,13 +69,13 @@ convertSSPResults <- function(x) { # ---- Bioenergy ---- selection <- c("Primary Energy|Biomass|1st Generation (EJ/yr)", - "Primary Energy|Biomass|Energy Crops (EJ/yr)", - "Agricultural Demand|Bioenergy|1st generation (million t DM/yr)", - "Agricultural Demand|Bioenergy|2nd generation (million t DM/yr)") + "Primary Energy|Biomass|Energy Crops (EJ/yr)", + "Agricultural Demand|Bioenergy|1st generation (million t DM/yr)", + "Agricultural Demand|Bioenergy|2nd generation (million t DM/yr)") # use harvested area as weight weightBio <- setYears(dimSums(calcOutput("Croparea", sectoral = "kcr", physical = TRUE, aggregate = FALSE), - dim = 3)[, 2010, ], NULL) + dim = 3)[, 2010, ], NULL) for (sel in selection) { print(sel) @@ -93,6 +93,10 @@ convertSSPResults <- function(x) { data <- x[, , selection] data[is.na(data)] <- 0 + data <- convertGDP(data, unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getNames(data, dim = 3) <- "Price|Carbon (US$2017/t CO2)" aggregatedREG <- toolAggregate(data, rel = mappingFile, weight = NULL, dim = 1, partrel = TRUE, from = "RegionCode", to = "CountryCode") aggregatedREG <- toolCountryFill(aggregatedREG, 000) @@ -103,6 +107,10 @@ convertSSPResults <- function(x) { selection <- c("Price|Primary Energy|Biomass (US$2005/GJ)") data <- x[, , selection] + data <- convertGDP(data, unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getNames(data, dim = 3) <- "Price|Primary Energy|Biomass (US$2017/GJ)" aggregatedREG <- toolAggregate(data, rel = mappingFile, weight = NULL, dim = 1, partrel = TRUE, from = "RegionCode", to = "CountryCode") aggregatedREG <- toolCountryFill(aggregatedREG, 000) @@ -110,57 +118,57 @@ convertSSPResults <- function(x) { ### check for NA's if (any(is.na(out))) { -vcat(verbosity = 1, "SSP3 results of MESSAGE-GLOBIOM contains NAs which where substituted by 0") -} + vcat(verbosity = 1, "SSP3 results of MESSAGE-GLOBIOM contains NAs which where substituted by 0") + } out[, c("y2005", "y2010"), "MESSAGE-GLOBIOM.Land Cover|Cropland|Energy Crops (million ha)"] <- 0 if (any(is.na(out))) { -vcat(verbosity = 1, "NAs in dataset") -} + vcat(verbosity = 1, "NAs in dataset") + } # ---- Select scenarios ---- subset <- c("SSP1-19-SPA1-V16.IMAGE", - "SSP1-26-SPA1-V15.IMAGE", - "SSP1-34-SPA1-V15.IMAGE", - "SSP1-45-SPA1-V15.IMAGE", - "SSP1-Ref-SPA0-V15.IMAGE", - - "SSP1-19-SPA1-V16.REMIND-MAGPIE", - "SSP1-26-SPA1-V15.REMIND-MAGPIE", - "SSP1-34-SPA1-V15.REMIND-MAGPIE", - "SSP1-45-SPA1-V15.REMIND-MAGPIE", - "SSP1-Ref-SPA0-V15.REMIND-MAGPIE", - - "SSP2-19-SPA2-V16.MESSAGE-GLOBIOM", - "SSP2-26-SPA2-V16.MESSAGE-GLOBIOM", - "SSP2-34-SPA2-V16.MESSAGE-GLOBIOM", - "SSP2-45-SPA2-V16.MESSAGE-GLOBIOM", - "SSP2-60-SPA2-V16.MESSAGE-GLOBIOM", - "SSP2-Ref-SPA0-V16.MESSAGE-GLOBIOM", - - "SSP2-19-SPA2-V16.REMIND-MAGPIE", - "SSP2-26-SPA2-V15.REMIND-MAGPIE", - "SSP2-34-SPA2-V15.REMIND-MAGPIE", - "SSP2-45-SPA2-V15.REMIND-MAGPIE", - "SSP2-60-SPA2-V15.REMIND-MAGPIE", - "SSP2-Ref-SPA0-V15.REMIND-MAGPIE", - - "SSP3-34-SPA3-V15.AIM/CGE", - "SSP3-45-SPA3-V15.AIM/CGE", - "SSP3-60-SPA3-V15.AIM/CGE", - - "SSP4-26-SPA4-V16.GCAM4", - "SSP4-34-SPA4-V16.GCAM4", - "SSP4-45-SPA4-V16.GCAM4", - "SSP4-60-SPA4-V16.GCAM4", - "SSP4-Ref-SPA0-V16.GCAM4", - - "SSP5-19-SPA5-V16.REMIND-MAGPIE", - "SSP5-26-SPA5-V15.REMIND-MAGPIE", - "SSP5-34-SPA5-V15.REMIND-MAGPIE", - "SSP5-45-SPA5-V15.REMIND-MAGPIE", - "SSP5-60-SPA5-V15.REMIND-MAGPIE", - "SSP5-Ref-SPA0-V15.REMIND-MAGPIE") + "SSP1-26-SPA1-V15.IMAGE", + "SSP1-34-SPA1-V15.IMAGE", + "SSP1-45-SPA1-V15.IMAGE", + "SSP1-Ref-SPA0-V15.IMAGE", + + "SSP1-19-SPA1-V16.REMIND-MAGPIE", + "SSP1-26-SPA1-V15.REMIND-MAGPIE", + "SSP1-34-SPA1-V15.REMIND-MAGPIE", + "SSP1-45-SPA1-V15.REMIND-MAGPIE", + "SSP1-Ref-SPA0-V15.REMIND-MAGPIE", + + "SSP2-19-SPA2-V16.MESSAGE-GLOBIOM", + "SSP2-26-SPA2-V16.MESSAGE-GLOBIOM", + "SSP2-34-SPA2-V16.MESSAGE-GLOBIOM", + "SSP2-45-SPA2-V16.MESSAGE-GLOBIOM", + "SSP2-60-SPA2-V16.MESSAGE-GLOBIOM", + "SSP2-Ref-SPA0-V16.MESSAGE-GLOBIOM", + + "SSP2-19-SPA2-V16.REMIND-MAGPIE", + "SSP2-26-SPA2-V15.REMIND-MAGPIE", + "SSP2-34-SPA2-V15.REMIND-MAGPIE", + "SSP2-45-SPA2-V15.REMIND-MAGPIE", + "SSP2-60-SPA2-V15.REMIND-MAGPIE", + "SSP2-Ref-SPA0-V15.REMIND-MAGPIE", + + "SSP3-34-SPA3-V15.AIM/CGE", + "SSP3-45-SPA3-V15.AIM/CGE", + "SSP3-60-SPA3-V15.AIM/CGE", + + "SSP4-26-SPA4-V16.GCAM4", + "SSP4-34-SPA4-V16.GCAM4", + "SSP4-45-SPA4-V16.GCAM4", + "SSP4-60-SPA4-V16.GCAM4", + "SSP4-Ref-SPA0-V16.GCAM4", + + "SSP5-19-SPA5-V16.REMIND-MAGPIE", + "SSP5-26-SPA5-V15.REMIND-MAGPIE", + "SSP5-34-SPA5-V15.REMIND-MAGPIE", + "SSP5-45-SPA5-V15.REMIND-MAGPIE", + "SSP5-60-SPA5-V15.REMIND-MAGPIE", + "SSP5-Ref-SPA0-V15.REMIND-MAGPIE") out <- out[, , subset] diff --git a/R/readIMPACT3.2.2World_Price.R b/R/readIMPACT3.2.2World_Price.R index 0d5ecc14..131c7858 100644 --- a/R/readIMPACT3.2.2World_Price.R +++ b/R/readIMPACT3.2.2World_Price.R @@ -19,5 +19,14 @@ readIMPACT3.2.2World_Price <- function() { # nolint: object_name_linter. data <- data[!is.na(data[[1]]), ] data$scenario <- sub(".", "p", data$scenario, fixed = TRUE) data <- as.magpie(data) + + #inflate to 2017 using US inflation for global value + getItems(data, dim = 1) <- "USA" + data <- GDPuc::convertGDP(data, + unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") + getItems(data, dim = 1) <- "GLO" + return(data) } diff --git a/README.md b/README.md index fac94956..9938e00e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat commons Input Data Library -R package **mrcommons**, version **1.43.1** +R package **mrcommons**, version **1.44.0** [![CRAN status](https://www.r-pkg.org/badges/version/mrcommons)](https://cran.r-project.org/package=mrcommons) [![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) @@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 1.43.1, . +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, 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 (2024). _mrcommons: MadRat commons Input Data Library_. doi:10.5281/zenodo.3822009 , R package version 1.44.0, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ 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 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}, year = {2024}, - note = {R package version 1.43.1}, + note = {R package version 1.44.0}, url = {https://github.com/pik-piam/mrcommons}, doi = {10.5281/zenodo.3822009}, } diff --git a/man/calcIniFoodPrice.Rd b/man/calcIniFoodPrice.Rd index 11f6e513..55ad5444 100644 --- a/man/calcIniFoodPrice.Rd +++ b/man/calcIniFoodPrice.Rd @@ -14,7 +14,7 @@ calcIniFoodPrice(datasource = "FAO", year = "y2005", products = "kfo") \item{products}{subselection of products to be returned} } \value{ -List with a magpie object with commodity prices on global level in $05/tDM. +List with a magpie object with commodity prices on global level in $17/tDM. } \description{ provides global prices from the IMPACT model projections for MAgPIE commodities diff --git a/man/calcPriceAgriculture.Rd b/man/calcPriceAgriculture.Rd index 7cd47fbc..8dc3864d 100644 --- a/man/calcPriceAgriculture.Rd +++ b/man/calcPriceAgriculture.Rd @@ -4,7 +4,7 @@ \alias{calcPriceAgriculture} \title{calcPriceAgriculture} \usage{ -calcPriceAgriculture(datasource = "IMPACT3.2.2World_Price", unit = "US$05/tDM") +calcPriceAgriculture(datasource = "IMPACT3.2.2World_Price", unit = "US$17/tDM") } \arguments{ \item{datasource}{Options of the source of data: diff --git a/man/convertICP2017.Rd b/man/convertICP2017.Rd index 4b9784f5..98cd991e 100644 --- a/man/convertICP2017.Rd +++ b/man/convertICP2017.Rd @@ -17,7 +17,7 @@ magpie object of relative price levels (world = 100) or per capita expenditure ( \description{ converts data of World Bank ICP round, downloaded from here: https://databank.worldbank.org/source/icp-2017 -mainly a currency conversion to MER05. Assume that in the original dataset, +mainly a currency conversion to MER2017. Assume that in the original dataset, 2011 values are in 2011MER and 2017 in 2017MER, given the ICP rounds } \examples{ From 8ffecfda7bb4641b11482637c3cdeaacf444f47b Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 23 Sep 2024 10:59:13 +0200 Subject: [PATCH 2/2] build library --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index db8f2cda..39483c30 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '28699896' +ValidationKey: '28784160' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 3379e6ad..2da75a08 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.43.6 -date-released: '2024-09-20' +version: 1.44.0 +date-released: '2024-09-23' 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 24956e6d..80b61ee6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mrcommons Type: Package Title: MadRat commons Input Data Library -Version: 1.43.6 -Date: 2024-09-20 +Version: 1.44.0 +Date: 2024-09-23 Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), person("Lavinia", "Baumstark", role = "aut"), diff --git a/README.md b/README.md index 61b1b2fe..9938e00e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat commons Input Data Library -R package **mrcommons**, version **1.43.6** +R package **mrcommons**, version **1.44.0** [![CRAN status](https://www.r-pkg.org/badges/version/mrcommons)](https://cran.r-project.org/package=mrcommons) [![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) @@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 1.43.6, . +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, 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 (2024). _mrcommons: MadRat commons Input Data Library_. doi:10.5281/zenodo.3822009 , R package version 1.44.0, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ 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 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}, year = {2024}, - note = {R package version 1.43.6}, + note = {R package version 1.44.0}, url = {https://github.com/pik-piam/mrcommons}, doi = {10.5281/zenodo.3822009}, }