Skip to content

Commit

Permalink
removed remaining moinput references
Browse files Browse the repository at this point in the history
  • Loading branch information
tscheypidi committed May 12, 2020
1 parent 15d2df1 commit 8e6f679
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
carbon_stored.*
^\.git$
^\.travis.yml
^codemeta\.json$
^.*\.zenodo.json$
82 changes: 82 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"title": "mrcommons: MadRat commons Input Data Library",
"version": "0.2.2",
"description": "<p>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"
}
]
}
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion R/calcAWMSconfShr.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/calcLandEmissions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/calcPopulation.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/calcPopulationFuture.R
Original file line number Diff line number Diff line change
@@ -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? }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/calcPopulationPast.R
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/calcSNUpE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/convertIIASApop.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions R/convertSRES.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion R/convertSSP.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions R/readLUH2v2.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions R/toolCountryCode2isocode.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -29,8 +31,25 @@ update.packages()

## Questions / Problems

In case of questions / problems please contact Jan Dietrich <dietrich@pik-potsdam.de>.
In case of questions / problems please contact Jan Philipp Dietrich <dietrich@pik-potsdam.de>.

## 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},
}
```

4 changes: 2 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library(testthat)
library(moinput)
library(mrcommons)

test_check("moinput")
test_check("mrcommons")

0 comments on commit 8e6f679

Please sign in to comment.