diff --git a/.buildlibrary b/.buildlibrary index fd1af60a..c6a3ef7e 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '288340884' +ValidationKey: '288360891' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' @@ -6,6 +6,7 @@ AcceptedNotes: - unable to verify current time - Imports includes .* non-default packages. - installed size is .* +- .* includes the non-default packages.* AutocreateReadme: yes allowLinterWarnings: no enforceVersionUpdate: no diff --git a/CITATION.cff b/CITATION.cff index 06a0ee46..cf53211d 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.44.12 +version: 1.44.13 date-released: '2024-10-11' 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 e9ca429e..3e1cf080 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrcommons Type: Package Title: MadRat commons Input Data Library -Version: 1.44.12 +Version: 1.44.13 Date: 2024-10-11 Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), @@ -40,6 +40,7 @@ Description: Provides useful functions and a common structure to all the input d and REMIND of model input data. Depends: R (>= 2.10.0), + GDPuc (>= 1.3.0), magclass (>= 3.17), madrat (>= 3.10.0), mrdrivers (>= 1.0.0), @@ -50,7 +51,6 @@ Imports: data.table, dplyr, hdf5r, - GDPuc (>= 1.0.5), luscale, magpiesets (>= 0.44.2), ncdf4, diff --git a/NAMESPACE b/NAMESPACE index 5e5646df..5337c5b8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,13 +28,14 @@ export(readHoulton2018) export(readJRC_IDEES) export(toolCalcIEAfromStructureMappingPEFE) export(toolPregnant) +import(GDPuc) import(madrat) import(magclass) import(mrdrivers) import(mrfaocore) import(mrlandcore) import(mstools) -importFrom(GDPuc,convertGDP) +importFrom(GDPuc,toolConvertGDP) importFrom(countrycode,countrycode) importFrom(data.table,":=") importFrom(data.table,as.data.table) diff --git a/R/calcGTAPTotalTransportCosts.R b/R/calcGTAPTotalTransportCosts.R index 0d3b4d6d..e02e8d0f 100644 --- a/R/calcGTAPTotalTransportCosts.R +++ b/R/calcGTAPTotalTransportCosts.R @@ -46,9 +46,9 @@ calcGTAPTotalTransportCosts <- function(costType = "transport", version = "9") { # half of transport of inputs to market and half of transport from market to consumer totalTcosts <- (tcostInputs + tcostToSecondary) / 2 - totalTcosts <- GDPuc::convertGDP(totalTcosts, unit_in = "current US$MER", - unit_out = "constant 2017 US$MER", - replace_NAs = "no_conversion") + totalTcosts <- GDPuc::toolConvertGDP(totalTcosts, unit_in = "current US$MER", + unit_out = "constant 2017 US$MER", + replace_NAs = "no_conversion") return(list(x = totalTcosts, weight = NULL, diff --git a/R/calcIniFoodPrice.R b/R/calcIniFoodPrice.R index 9f628a40..9706c654 100644 --- a/R/calcIniFoodPrice.R +++ b/R/calcIniFoodPrice.R @@ -75,9 +75,9 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo "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") + out[, , conv] <- GDPuc::toolConvertGDP(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 @@ -122,9 +122,9 @@ calcIniFoodPrice <- function(datasource = "FAO", year = "y2005", products = "kfo "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") + out[, , conv] <- GDPuc::toolConvertGDP(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 diff --git a/R/calcMAgPIEReport.R b/R/calcMAgPIEReport.R index 399a5517..61473458 100644 --- a/R/calcMAgPIEReport.R +++ b/R/calcMAgPIEReport.R @@ -7,7 +7,7 @@ calcMAgPIEReport <- function(subtype) { # with transformation factor from 10E6 US$2005 to 10E12 US$2005 x <- x[, , "Costs Without Incentives (million US$05/yr)"] / 1000 / 1000 # convert from US$2005 -> US$2017 - x <- GDPuc::convertGDP( + x <- GDPuc::toolConvertGDP( gdp = x, unit_in = "constant 2005 US$MER", unit_out = "constant 2017 Int$PPP", @@ -20,7 +20,7 @@ calcMAgPIEReport <- function(subtype) { # with transformation factor from 10E6 US$2005 to 10E12 US$2005 x <- x[, , "Costs Accounting|+|MACCS (million US$05/yr)"] / 1000 / 1000 # convert from US$2005 -> US$2017 - x <- GDPuc::convertGDP( + x <- GDPuc::toolConvertGDP( gdp = x, unit_in = "constant 2005 US$MER", unit_out = "constant 2017 Int$PPP", diff --git a/R/calcPriceAgriculture.R b/R/calcPriceAgriculture.R index 1a404342..7995340c 100644 --- a/R/calcPriceAgriculture.R +++ b/R/calcPriceAgriculture.R @@ -186,10 +186,10 @@ calcPriceAgriculture <- function(datasource = "IMPACT3.2.2World_Price", unit = " if (unit != "US$17/tDM") { # Transform to selected currency unit - out <- GDPuc::convertGDP(out, - unit_in = "constant 2017 US$MER", - unit_out = unit, - replace_NAs = "no_conversion") + out <- GDPuc::toolConvertGDP(out, + unit_in = "constant 2017 US$MER", + unit_out = unit, + replace_NAs = "no_conversion") } if (!is.null(weight)) { diff --git a/R/calcWBGEM.R b/R/calcWBGEM.R index 1582aa94..93ac7e9a 100644 --- a/R/calcWBGEM.R +++ b/R/calcWBGEM.R @@ -47,9 +47,9 @@ calcWBGEM <- function() { # 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") + out <- GDPuc::toolConvertGDP(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, diff --git a/R/convertGTAPv8v9.R b/R/convertGTAPv8v9.R index 05e90126..6746115d 100644 --- a/R/convertGTAPv8v9.R +++ b/R/convertGTAPv8v9.R @@ -8,7 +8,7 @@ #' \dontrun{ #' a <- readSource("convertGTAPv8v9", "81:SF01", convert = TRUE) #' } -#' @importFrom GDPuc convertGDP +#' @importFrom GDPuc toolConvertGDP convertGTAPv8v9 <- function(x, subtype) { split <- toolSplitSubtype(subtype, list(version = NULL, header = NULL)) @@ -68,10 +68,10 @@ convertGTAPv8v9 <- function(x, subtype) { gdpMer <- calcOutput("GDPPast", GDPPast = "WDI-MI", unit = "constant 2017 US$MER", aggregate = FALSE) gdpMer <- gdpMer[, getYears(x), , drop = TRUE] - w1 <- GDPuc::convertGDP(gdpMer, - unit_in = "constant 2017 US$MER", - unit_out = "current US$MER", - replace_NAs = "no_conversion") + w1 <- GDPuc::toolConvertGDP(gdpMer, + unit_in = "constant 2017 US$MER", + unit_out = "current US$MER", + replace_NAs = "no_conversion") getNames(w1) <- NULL w2 <- w1 diff --git a/R/convertICP2017.R b/R/convertICP2017.R index e26b69c0..3ada602d 100644 --- a/R/convertICP2017.R +++ b/R/convertICP2017.R @@ -17,9 +17,9 @@ 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 2017 US$MER") + x2011 <- GDPuc::toolConvertGDP(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 @@ -28,9 +28,9 @@ 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 2017 US$MER") + x2011 <- GDPuc::toolConvertGDP(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 diff --git a/R/convertSSPResults.R b/R/convertSSPResults.R index bfe41dc3..be93c758 100644 --- a/R/convertSSPResults.R +++ b/R/convertSSPResults.R @@ -94,8 +94,8 @@ convertSSPResults <- function(x) { data <- x[, , selection] data[is.na(data)] <- 0 #convert from USD05MER to USD17MER based on USA values for all countries as the CO2 price is global. - data <- data * round(GDPuc::convertSingle(1, "USA", unit_in = "constant 2005 US$MER", - unit_out = "constant 2017 US$MER"), 2) + data <- data * round(GDPuc::toolConvertSingle(1, "USA", unit_in = "constant 2005 US$MER", + unit_out = "constant 2017 US$MER"), 2) 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") @@ -107,9 +107,9 @@ 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") + data <- toolConvertGDP(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") diff --git a/R/imports.R b/R/imports.R index 54997f32..84aa8a14 100644 --- a/R/imports.R +++ b/R/imports.R @@ -1,4 +1,4 @@ # Generated by lucode2: do not edit by hand -#' @import magclass madrat mrdrivers mrfaocore mrlandcore mstools +#' @import GDPuc magclass madrat mrdrivers mrfaocore mrlandcore mstools NULL diff --git a/R/readIMPACT3.2.2World_Price.R b/R/readIMPACT3.2.2World_Price.R index 131c7858..1adbd132 100644 --- a/R/readIMPACT3.2.2World_Price.R +++ b/R/readIMPACT3.2.2World_Price.R @@ -22,10 +22,10 @@ readIMPACT3.2.2World_Price <- function() { # nolint: object_name_linter. #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") + data <- GDPuc::toolConvertGDP(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 43832cf0..53a409e7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat commons Input Data Library -R package **mrcommons**, version **1.44.12** +R package **mrcommons**, version **1.44.13** [![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.44.12, . +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.13, . A BibTeX entry for LaTeX users is @@ -48,8 +48,8 @@ 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.44.12}, - doi = {10.5281/zenodo.3822009}, + note = {R package version 1.44.13}, url = {https://github.com/pik-piam/mrcommons}, + doi = {10.5281/zenodo.3822009}, } ```