diff --git a/.buildlibrary b/.buildlibrary index 9149de89..c0cf4c17 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '17255420' +ValidationKey: '17274382' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/.zenodo.json b/.zenodo.json index ba5d9965..88a9fad7 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "mrremind: MadRat REMIND Input Data Package", - "version": "0.91.0", + "version": "0.91.1", "description": "
The mrremind packages contains data preprocessing for the REMIND model.<\/p>", "creators": [ { diff --git a/DESCRIPTION b/DESCRIPTION index 3648327d..b3a49286 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrremind Type: Package Title: MadRat REMIND Input Data Package -Version: 0.91.0 +Version: 0.91.1 Date: 2021-12-01 Authors@R: c(person("Lavinia", "Baumstark", email = "lavinia@pik-potsdam.de", role = c("aut","cre")), person("Renato", "Rodrigues", role = "aut"), diff --git a/R/calcFE.R b/R/calcFE.R index 09900baa..00d75e93 100644 --- a/R/calcFE.R +++ b/R/calcFE.R @@ -36,53 +36,77 @@ calcFE <- function(source = "IEA", scenario_proj = "SSP2") { # rename entries of data to match the reporting names getNames(x) <- paste0(map$output," (EJ/yr)") + # add more variables + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE],dim=3),"FE (EJ/yr)")) + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Electricity",pmatch=TRUE],dim=3),"FE|Electricity (EJ/yr)")) + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Gases",pmatch=TRUE],dim=3),"FE|Gases (EJ/yr)")) + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Heat",pmatch=TRUE],dim=3),"FE|Heat (EJ/yr)")) + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Liquids",pmatch=TRUE],dim=3),"FE|Liquids (EJ/yr)")) + x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Solids",pmatch=TRUE],dim=3),"FE|Solids (EJ/yr)")) + # aggregate CHP and nonCHP electricity - x <- mbind(x,setNames(x[,,"SE|Electricity|Coal|CHP (EJ/yr)"] + x[,,"SE|Electricity|Coal|nonCHP (EJ/yr)"],"SE|Electricity|Coal (EJ/yr)")) - x <- mbind(x,setNames(x[,,"SE|Electricity|Gas|CHP (EJ/yr)"] + x[,,"SE|Electricity|Gas|nonCHP (EJ/yr)"],"SE|Electricity|Gas (EJ/yr)")) - x <- mbind(x,setNames(x[,,"SE|Electricity|Biomass|CHP (EJ/yr)"] + x[,,"SE|Electricity|Biomass|nonCHP (EJ/yr)"],"SE|Electricity|Biomass (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Electricity|Coal|CHP (EJ/yr)"] + + x[,,"SE|Electricity|Coal|nonCHP (EJ/yr)"], "SE|Electricity|Coal (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Electricity|Gas|CHP (EJ/yr)"] + + x[,,"SE|Electricity|Gas|nonCHP (EJ/yr)"], "SE|Electricity|Gas (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Electricity|Biomass|CHP (EJ/yr)"] + + x[,,"SE|Electricity|Biomass|nonCHP (EJ/yr)"], "SE|Electricity|Biomass (EJ/yr)")) # aggregate CHP and HP heat - x <- mbind(x,setNames(x[,,"SE|Heat|Coal|CHP (EJ/yr)"] + x[,,"SE|Heat|Coal|HP (EJ/yr)"],"SE|Heat|Coal (EJ/yr)")) - x <- mbind(x,setNames(x[,,"SE|Heat|Gas|CHP (EJ/yr)"] + x[,,"SE|Heat|Gas|HP (EJ/yr)"],"SE|Heat|Gas (EJ/yr)")) - x <- mbind(x,setNames(x[,,"SE|Heat|Biomass|CHP (EJ/yr)"] + x[,,"SE|Heat|Biomass|HP (EJ/yr)"],"SE|Heat|Biomass (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Heat|Coal|CHP (EJ/yr)"] + + x[,,"SE|Heat|Coal|HP (EJ/yr)"], "SE|Heat|Coal (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Heat|Gas|CHP (EJ/yr)"] + + x[,,"SE|Heat|Gas|HP (EJ/yr)"], "SE|Heat|Gas (EJ/yr)")) + x <- mbind(x,setNames(x[,,"SE|Heat|Biomass|CHP (EJ/yr)"] + + x[,,"SE|Heat|Biomass|HP (EJ/yr)"], "SE|Heat|Biomass (EJ/yr)")) # rename Diesel/Petrol to LDV/non-LDV - x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Diesel|Biomass (EJ/yr)"],"FE|Transport|non-LDV|Liquids|Biomass (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Diesel|Fossil (EJ/yr)"], "FE|Transport|non-LDV|Liquids|Fossil (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Petrol|Biomass (EJ/yr)"],"FE|Transport|LDV|Liquids|Biomass (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Petrol|Fossil (EJ/yr)"], "FE|Transport|LDV|Liquids|Fossil (EJ/yr)")) - x <- x[,,c("FE|Transport|Liquids|Diesel|Biomass (EJ/yr)","FE|Transport|Liquids|Diesel|Fossil (EJ/yr)","FE|Transport|Liquids|Petrol|Biomass (EJ/yr)","FE|Transport|Liquids|Petrol|Fossil (EJ/yr)"),invert=TRUE] + x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Diesel|Biomass (EJ/yr)"], "FE|Transport|non-LDV|Liquids|Biomass (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Diesel|Fossil (EJ/yr)"], "FE|Transport|non-LDV|Liquids|Fossil (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Petrol|Biomass (EJ/yr)"], "FE|Transport|LDV|Liquids|Biomass (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Petrol|Fossil (EJ/yr)"], "FE|Transport|LDV|Liquids|Fossil (EJ/yr)")) + x <- x[,, c("FE|Transport|Liquids|Diesel|Biomass (EJ/yr)", + "FE|Transport|Liquids|Diesel|Fossil (EJ/yr)", + "FE|Transport|Liquids|Petrol|Biomass (EJ/yr)", + "FE|Transport|Liquids|Petrol|Fossil (EJ/yr)"), invert=TRUE] # aggregate LDV and non-LDV to Liquids|Biomass/Fossil - x <- mbind(x,setNames(x[,,"FE|Transport|LDV|Liquids|Biomass (EJ/yr)"] + x[,,"FE|Transport|non-LDV|Liquids|Biomass (EJ/yr)"],"FE|Transport|Liquids|Biomass (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|LDV|Liquids|Fossil (EJ/yr)"] + x[,,"FE|Transport|non-LDV|Liquids|Fossil (EJ/yr)"],"FE|Transport|Liquids|Fossil (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|LDV|Liquids|Biomass (EJ/yr)"] + + x[,,"FE|Transport|non-LDV|Liquids|Biomass (EJ/yr)"], "FE|Transport|Liquids|Biomass (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|LDV|Liquids|Fossil (EJ/yr)"] + + x[,,"FE|Transport|non-LDV|Liquids|Fossil (EJ/yr)"], "FE|Transport|Liquids|Fossil (EJ/yr)")) # aggregate biomass and fossil data - x <- mbind(x,setNames(x[,,"FE|Buildings|Gases|Biomass (EJ/yr)"] + x[,,"FE|Buildings|Gases|Fossil (EJ/yr)"],"FE|Buildings|Gases (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Industry|Gases|Biomass (EJ/yr)"] + x[,,"FE|Industry|Gases|Fossil (EJ/yr)"],"FE|Industry|Gases (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|Gases|Biomass (EJ/yr)"] + x[,,"FE|Transport|Gases|Fossil (EJ/yr)"],"FE|Transport|Gases (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Gases|Biomass (EJ/yr)"] + + x[,,"FE|Buildings|Gases|Fossil (EJ/yr)"], "FE|Buildings|Gases (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Industry|Gases|Biomass (EJ/yr)"] + + x[,,"FE|Industry|Gases|Fossil (EJ/yr)"], "FE|Industry|Gases (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|Gases|Biomass (EJ/yr)"] + + x[,,"FE|Transport|Gases|Fossil (EJ/yr)"], "FE|Transport|Gases (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Buildings|Liquids|Biomass (EJ/yr)"] + x[,,"FE|Buildings|Liquids|Fossil (EJ/yr)"],"FE|Buildings|Liquids (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Industry|Liquids|Biomass (EJ/yr)"] + x[,,"FE|Industry|Liquids|Fossil (EJ/yr)"],"FE|Industry|Liquids (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Biomass (EJ/yr)"] + x[,,"FE|Transport|Liquids|Fossil (EJ/yr)"],"FE|Transport|Liquids (EJ/yr)")) - - x <- mbind(x,setNames(x[,,"FE|Buildings|Solids|Biomass (EJ/yr)"] + x[,,"FE|Buildings|Solids|Fossil (EJ/yr)"],"FE|Buildings|Solids (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Industry|Solids|Biomass (EJ/yr)"] + x[,,"FE|Industry|Solids|Fossil (EJ/yr)"],"FE|Industry|Solids (EJ/yr)")) - - # add more variables - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE],dim=3),"FE (EJ/yr)")) - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Electricity",pmatch=TRUE],dim=3),"FE|Electricity (EJ/yr)")) - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Gases",pmatch=TRUE],dim=3),"FE|Gases (EJ/yr)")) - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Heat",pmatch=TRUE],dim=3),"FE|Heat (EJ/yr)")) - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Liquids",pmatch=TRUE],dim=3),"FE|Liquids (EJ/yr)")) - x <- mbind(x,setNames(dimSums(x[,,"FE|",pmatch=TRUE][,,"Solids",pmatch=TRUE],dim=3),"FE|Solids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Liquids|Biomass (EJ/yr)"] + + x[,,"FE|Buildings|Liquids|Fossil (EJ/yr)"], "FE|Buildings|Liquids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Industry|Liquids|Biomass (EJ/yr)"] + + x[,,"FE|Industry|Liquids|Fossil (EJ/yr)"], "FE|Industry|Liquids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Transport|Liquids|Biomass (EJ/yr)"] + + x[,,"FE|Transport|Liquids|Fossil (EJ/yr)"], "FE|Transport|Liquids (EJ/yr)")) + + x <- mbind(x,setNames(x[,,"FE|Buildings|Solids|Biomass (EJ/yr)"] + + x[,,"FE|Buildings|Solids|Fossil (EJ/yr)"], "FE|Buildings|Solids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Industry|Solids|Biomass (EJ/yr)"] + + x[,,"FE|Industry|Solids|Fossil (EJ/yr)"], "FE|Industry|Solids (EJ/yr)")) # add stationary - x <- mbind(x,setNames(x[,,"FE|Buildings|Electricity (EJ/yr)"] + x[,,"FE|Industry|Electricity (EJ/yr)"],"FE|Stationary|Electricity (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Buildings|Gases (EJ/yr)"] + x[,,"FE|Industry|Gases (EJ/yr)"], "FE|Stationary|Gases (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Buildings|Heat (EJ/yr)"] + x[,,"FE|Industry|Heat (EJ/yr)"], "FE|Stationary|Heat (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Buildings|Liquids (EJ/yr)"] + x[,,"FE|Industry|Liquids (EJ/yr)"], "FE|Stationary|Liquids (EJ/yr)")) - x <- mbind(x,setNames(x[,,"FE|Buildings|Solids (EJ/yr)"] + x[,,"FE|Industry|Solids (EJ/yr)"], "FE|Stationary|Solids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Electricity (EJ/yr)"] + + x[,,"FE|Industry|Electricity (EJ/yr)"], "FE|Stationary|Electricity (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Gases (EJ/yr)"] + + x[,,"FE|Industry|Gases (EJ/yr)"], "FE|Stationary|Gases (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Heat (EJ/yr)"] + + x[,,"FE|Industry|Heat (EJ/yr)"], "FE|Stationary|Heat (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Liquids (EJ/yr)"] + + x[,,"FE|Industry|Liquids (EJ/yr)"], "FE|Stationary|Liquids (EJ/yr)")) + x <- mbind(x,setNames(x[,,"FE|Buildings|Solids (EJ/yr)"] + + x[,,"FE|Industry|Solids (EJ/yr)"], "FE|Stationary|Solids (EJ/yr)")) # add total for buildings x <- mbind(x,setNames(x[,,"FE|Buildings|Liquids (EJ/yr)"] diff --git a/README.md b/README.md index 7ec11430..fa76fb4b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.90.3** +R package **mrremind**, version **0.91.1** [![CRAN status](https://www.r-pkg.org/badges/version/mrremind)](https://cran.r-project.org/package=mrremind) [![R build status](https://github.com/pik-piam/mrremind/workflows/check/badge.svg)](https://github.com/pik-piam/mrremind/actions) [![codecov](https://codecov.io/gh/pik-piam/mrremind/branch/master/graph/badge.svg)](https://codecov.io/gh/pik-piam/mrremind) [![r-universe](https://pik-piam.r-universe.dev/badges/mrremind)](https://pik-piam.r-universe.dev/ui#builds) diff --git a/man/readMueller.Rd b/man/readMueller.Rd new file mode 100644 index 00000000..fca03d91 --- /dev/null +++ b/man/readMueller.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/readMueller.R +\name{readMueller} +\alias{readMueller} +\title{Read Müller et al. 2013 data.} +\usage{ +readMueller(subtype) +} +\arguments{ +\item{subtype}{One of: +\itemize{ +\item \code{countries}: read table mapping country names use by Müller et al. 2013 +to ISO 3166-1 alpha-3 codes. +\item \code{stocks}: read low/medium/high estimates of per-capita steel stocks from +Müller et al. 2013 SI2 +}} +} +\value{ +A \code{\link[magclass:magclass-package]{magpie}} object. +} +\description{ +Read data from Müller et al. 2013 (http://dx.doi.org/10.1021/es402618m). +} +\seealso{ +\code{\link[=readSource]{readSource()}} +} +\author{ +Michaja Pehl +}