From 8e6f679311510afe2f568aeccb19d859ade06b75 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Tue, 12 May 2020 11:59:22 +0200 Subject: [PATCH] removed remaining moinput references --- .Rbuildignore | 2 + .zenodo.json | 82 +++++++++++++++++++++++++++++++++++++ DESCRIPTION | 6 +-- R/calcAWMSconfShr.R | 2 +- R/calcLandEmissions.R | 2 +- R/calcPopulation.R | 2 +- R/calcPopulationFuture.R | 2 +- R/calcPopulationPast.R | 2 +- R/calcSNUpE.R | 2 +- R/convertIIASApop.R | 2 +- R/convertSRES.R | 4 -- R/convertSSP.R | 2 +- R/readLUH2v2.R | 3 -- R/toolCountryCode2isocode.R | 3 +- README.md | 29 ++++++++++--- tests/testthat.R | 4 +- 16 files changed, 122 insertions(+), 27 deletions(-) create mode 100644 .zenodo.json diff --git a/.Rbuildignore b/.Rbuildignore index 536c2493..47094960 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,5 @@ carbon_stored.* ^\.git$ ^\.travis.yml +^codemeta\.json$ +^.*\.zenodo.json$ diff --git a/.zenodo.json b/.zenodo.json new file mode 100644 index 00000000..bc0bd7c2 --- /dev/null +++ b/.zenodo.json @@ -0,0 +1,82 @@ +{ + "title": "mrcommons: MadRat commons Input Data Library", + "version": "0.2.2", + "description": "

Provides useful functions and a common structure to all the input data required to run models like MAgPIE and REMIND\n of model input data.<\/p>", + "creators": [ + { + "name": "Bodirsky, Benjamin Leon" + }, + { + "name": "Karstens, Kristine" + }, + { + "name": "Baumstark, Lavinia" + }, + { + "name": "Weindl, Isabelle" + }, + { + "name": "Wang, Xiaoxi" + }, + { + "name": "Mishra, Abhijeet" + }, + { + "name": "Wirth, Stephen" + }, + { + "name": "Stevanovic, Mishko" + }, + { + "name": "Steinmetz, Nele" + }, + { + "name": "Kreidenweis, Ulrich" + }, + { + "name": "Rodrigues, Renato" + }, + { + "name": "Popov, Roman" + }, + { + "name": "Humpenoeder, Florian" + }, + { + "name": "Giannousakis, Anastasis" + }, + { + "name": "Levesque, Antoine" + }, + { + "name": "Klein, David" + }, + { + "name": "Araujo, Ewerton" + }, + { + "name": "Beier, Felicitas" + }, + { + "name": "Oeser, Julian" + }, + { + "name": "Pehl, Michaja" + }, + { + "name": "Leip, Debbora" + }, + { + "name": "Molina Bacca, Edna" + }, + { + "name": "Martinelli, Eleonora" + }, + { + "name": "Schreyer, Felix" + }, + { + "name": "Dietrich, Jan Philipp" + } + ] +} diff --git a/DESCRIPTION b/DESCRIPTION index 007652ab..31958732 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mrcommons Type: Package Title: MadRat commons Input Data Library -Version: 0.2.1 -Date: 2020-05-11 +Version: 0.2.2 +Date: 2020-05-12 Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), person("Lavinia", "Baumstark", role = "aut"), @@ -64,7 +64,7 @@ License: LGPL-3 | file LICENSE LazyData: no Encoding: UTF-8 RoxygenNote: 7.1.0 -ValidationKey: 386253 +ValidationKey: 404668 Suggests: knitr, testthat, diff --git a/R/calcAWMSconfShr.R b/R/calcAWMSconfShr.R index 94b4a4fa..0dd8844b 100644 --- a/R/calcAWMSconfShr.R +++ b/R/calcAWMSconfShr.R @@ -1,6 +1,6 @@ #' @title calcAWMSconfShr #' @description calculates the share of manure managed in different animal waste management systems in confinements. Starting with IPCC 2005 values, turning into scenarios for the future. -#' @param rev revision number of moinput run +#' @param rev revision number of madrat run #' @return List of magpie objects with results on country level, weight on country level, unit and description. #' @author Benjamin Leon Bodirsky. Modifications by Edna J. Molina Bacca #' @seealso diff --git a/R/calcLandEmissions.R b/R/calcLandEmissions.R index e9a328bf..8b8d82dc 100644 --- a/R/calcLandEmissions.R +++ b/R/calcLandEmissions.R @@ -2,7 +2,7 @@ #' @description Land emission data. This function was originally called calcValidEmissions and located in #' mrvalidation. #' -#' @param datasource The Emission Inventory that shall be used. For futher information, best see moinput function calcEmissionInventory. Options are e.g. CEDS, combined_CEDS_IPCC (including own estimates where available), IPCC(own estimates), Nsurplus (own estimates) +#' @param datasource The Emission Inventory that shall be used. For futher information, best see function calcEmissionInventory. Options are e.g. CEDS, combined_CEDS_IPCC (including own estimates where available), IPCC(own estimates), Nsurplus (own estimates) #' #' @return List of magpie object with results on country level, weight on country level, unit and description. #' @author Benjamin Leon Bodirsky diff --git a/R/calcPopulation.R b/R/calcPopulation.R index d15fffa8..7e2c00ca 100644 --- a/R/calcPopulation.R +++ b/R/calcPopulation.R @@ -1,7 +1,7 @@ #' calcPopulation #' #' Merges time series of population for the past and present. Different sources -#' are available and can be selected in the moinput config. See +#' are available and can be selected in the madrat config. See #' \code{\link{calcPopulationPast}} for past datasets, and #' \code{\link{calcPopulationFuture}} for future datasets. The time series are #' merged via the growth rates. The first year of the future scenarios diff --git a/R/calcPopulationFuture.R b/R/calcPopulationFuture.R index 4c122502..112fad0b 100644 --- a/R/calcPopulationFuture.R +++ b/R/calcPopulationFuture.R @@ -1,7 +1,7 @@ #' calcPopulationFuture #' #' Calculates a time series of Population. Different sources are available and -#' can be selected in the moinput config (getConfig()$calc$PopulationPast): +#' can be selected in the madrat config (getConfig()$calc$PopulationPast): #' \itemize{ \item \code{"IIASApop"}: Source: IIASA? Lavinia? \item #' \code{"IIASApop"}: Source: Lavinia? } #' diff --git a/R/calcPopulationPast.R b/R/calcPopulationPast.R index 31da27ed..3be217d6 100644 --- a/R/calcPopulationPast.R +++ b/R/calcPopulationPast.R @@ -1,7 +1,7 @@ #' calcPopulationPast #' #' Calculates a time series of Population. Different sources are available and -#' can be selected in the moinput config(getConfig()$calc$PopulationPast): +#' can be selected in the madrat config(getConfig()$calc$PopulationPast): #' \itemize{ #' \item \code{WDI}: Source: Worldbank. Taiwan was estimated as the #' difference between all countries and the global total. diff --git a/R/calcSNUpE.R b/R/calcSNUpE.R index 9d704253..4c3b4399 100644 --- a/R/calcSNUpE.R +++ b/R/calcSNUpE.R @@ -2,7 +2,7 @@ #' @description calculates the soil nitrogen uptake efficiency. This is the nitrogen taken up from the soil (N in crop biomass minus biological fixation minus seed N) divided by the soil N inputs (fertilizer, manure etc). For the future, SNuPE scenarios are added. #' @param max_snupe Maximum realistic SNUPE. All values above will be limited to this value. Only holds for past values; future scneario values can exceed this number. #' @param cellular disaggregated to 0.5 degree grid -#' @param rev revision number of moinput run +#' @param rev revision number of madrat run #' @return List of magpie objects with results on country level, weight on country level, unit and description. #' @author Benjamin Leon Bodirsky #' @seealso diff --git a/R/convertIIASApop.R b/R/convertIIASApop.R index 039428c1..1fd235ea 100644 --- a/R/convertIIASApop.R +++ b/R/convertIIASApop.R @@ -72,7 +72,7 @@ convertIIASApop <- function(x) { x <- mbind(x,TWN) # FIXME woher die Daten für 2010??? historische Quelle #-------------------------------------------------------------------------------- - #check whether the country list agrees with the list of countries in the moinput library + #check whether the country list agrees with the list of countries in the madrat library #remove unrequired data, add missing data x <- toolCountryFill(x,fill=0) return(x) diff --git a/R/convertSRES.R b/R/convertSRES.R index 623468ed..48918057 100644 --- a/R/convertSRES.R +++ b/R/convertSRES.R @@ -34,8 +34,6 @@ convertSRES<-function(x,subtype){ #split according to JAMES PPP popWDI<-readSource(type = "WDI",subtype="SP.POP.TOTL") - - #data(moinput) region_from<-"SCG" countries_to<-ISOhistorical$toISO[which(ISOhistorical$fromISO==region_from)] @@ -44,8 +42,6 @@ convertSRES<-function(x,subtype){ } else if (substring(subtype,nchar(subtype)-2)=="gdp"){ gdpJames<-readSource(type = "James",subtype="IHME_USD05_PPP_pc") - - #data(moinput) region_from<-"SCG" countries_to<-ISOhistorical$toISO[which(ISOhistorical$fromISO==region_from)] diff --git a/R/convertSSP.R b/R/convertSSP.R index 217b09a2..cc78070c 100644 --- a/R/convertSSP.R +++ b/R/convertSSP.R @@ -94,7 +94,7 @@ convertSSP <- function(x,subtype) { x[is.na(x)] <- 0 # substitute NA by 0 #-------------------------------------------------------------------------------- - # check whether the country list agrees with the list of countries in the moinput library + # check whether the country list agrees with the list of countries in the madrat library # remove unrequired data, add missing data x <- toolCountryFill(x, fill=0) diff --git a/R/readLUH2v2.R b/R/readLUH2v2.R index 2d4d2a75..a20aa96d 100644 --- a/R/readLUH2v2.R +++ b/R/readLUH2v2.R @@ -122,9 +122,6 @@ readLUH2v2 <- function(subtype) { data_states <- c("c3ann","c3per","c4ann","c4per","c3nfx","c3ann") data <- matrix(data=c(data_man,data_states),ncol=2) - #get coords - data("magpie_coord", envir=environment(), package = "moinput") - #land area carea <- raster("staticData_quarterdeg.nc",varname="carea") extent(carea) <- c(-180,180,-90,90) diff --git a/R/toolCountryCode2isocode.R b/R/toolCountryCode2isocode.R index 2701e98e..32db91dd 100644 --- a/R/toolCountryCode2isocode.R +++ b/R/toolCountryCode2isocode.R @@ -1,6 +1,5 @@ toolCountryCode2isocode <- function(code) { - code <- as.character(code) - #data(moinput) + code <- as.character(code) if (length(code) > 100) { # transformation into factor for better performance. Applied only to large objects. code <- as.factor(code) countrycode2iso <- read.csv2(system.file("extdata","countrycode2iso.csv",package = "mrcommons"),row.names=NULL) diff --git a/README.md b/README.md index 159b0548..a5802e6b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -# R mrcommons package -[![Travis build status](https://travis-ci.com/pik-piam/mrcommons.svg?branch=master)](https://travis-ci.com/pik-piam/mrcommons) +# MadRat commons Input Data Library +#### R package **mrcommons**, version **0.2.2** + ## Purpose and Functionality -MadRat commons data package provides commonly used data sources and calculations. +Provides useful functions and a common structure to all the input data required to run models like MAgPIE and REMIND + of model input data. ## Installation @@ -29,8 +31,25 @@ update.packages() ## Questions / Problems -In case of questions / problems please contact Jan Dietrich . +In case of questions / problems please contact Jan Philipp Dietrich . ## Citation -citation("mrcommons") +To cite package **mrcommons** in publications use: + +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, +Molina Bacca E, Martinelli E, Schreyer F, Dietrich J (2020). _mrcommons: MadRat commons Input Data Library_. R +package version 0.2.2. + +A BibTeX entry for LaTeX users is + + ```latex +@Manual{, + 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 Edna {Molina Bacca} and Eleonora Martinelli and Felix Schreyer and Jan Philipp Dietrich}, + year = {2020}, + note = {R package version 0.2.2}, +} +``` + diff --git a/tests/testthat.R b/tests/testthat.R index d9a31427..7db93f80 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,4 +1,4 @@ library(testthat) -library(moinput) +library(mrcommons) -test_check("moinput") +test_check("mrcommons")