Skip to content

Commit

Permalink
Merge branch 'master' into efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Mar 8, 2024
2 parents c3fbf62 + 07a1e4b commit 5ebd6c3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '224695314'
ValidationKey: '224749174'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'remind2: The REMIND R package (2nd generation)'
version: 1.135.8
date-released: '2024-03-01'
version: 1.135.9
date-released: '2024-03-04'
abstract: Contains the REMIND-specific routines for data and model output manipulation.
authors:
- family-names: Rodrigues
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: remind2
Title: The REMIND R package (2nd generation)
Version: 1.135.8
Date: 2024-03-01
Version: 1.135.9
Date: 2024-03-04
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
44 changes: 22 additions & 22 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200
}

# Read-in plastic-related variables
vm_plasticsCarbon <- readGDX(gdx, "vm_plasticsCarbon", field = "l", restore_zeros = FALSE, react = "silent")[,t,]
if (length(vm_plasticsCarbon) == 0) {
vm_plasticsCarbon <- NULL
v37_plasticsCarbon <- readGDX(gdx, "v37_plasticsCarbon", field = "l", restore_zeros = FALSE, react = "silent")[,t,]
if (length(v37_plasticsCarbon) == 0) {
v37_plasticsCarbon <- NULL
}

if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
vm_feedstockEmiUnknownFate <- readGDX(gdx, "vm_feedstockEmiUnknownFate", field = "l", restore_zeros = FALSE,
spatial = 2, react = "silent")[,t,]
vm_incinerationEmi <- readGDX(gdx, "vm_incinerationEmi", field = "l", restore_zeros = FALSE,
Expand All @@ -336,8 +336,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

# create new variable for carbon embedded in non-incinerated plastics:
# plastics that do not get incinerated and come from biogenic sources
# or synfuels (regardless of synfuel origin)
if (!is.null(vm_plasticsCarbon)) {
# or synfuels (regardless of syfuel origin)
if (!is.null(v37_plasticsCarbon)) {
plastic_CDR <- mselect(vm_nonIncineratedPlastics, all_enty = c(entySEbio, entySEsyn))
} else {
plastic_CDR <- collapseDim(vm_co2eq)*0
Expand Down Expand Up @@ -483,7 +483,7 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

# CO2 emissions from the end-of-life of carbon-bearing products

if (!is.null(vm_plasticsCarbon)) {
if (!is.null(v37_plasticsCarbon)) {
out <- mbind(out,
setNames(dimSums(vm_feedstockEmiUnknownFate, dim=3)* GtC_2_MtCO2,
"Emi|CO2|Energy|Waste|+|Feedstocks unknown fate (Mt CO2/yr)"),
Expand Down Expand Up @@ -676,7 +676,7 @@ if (!is.null(vm_plasticsCarbon)) {
EmiIndSubSec <- pm_emifac.fe.indst * o37_demFeIndSub_woNonEn[, , getNames(pm_emifac.fe.indst)]

# calculate demand-side Solids, Liquids and gases emissions (after industry CO2 Capture)
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
out <- mbind(out,

# solids emissions: direct solids emissions of all sectors - industry CCS of solids
Expand Down Expand Up @@ -810,7 +810,7 @@ if (!is.null(vm_plasticsCarbon)) {
variable = paste0(variable_prefix, .data$variable, variable_postfix))

# if feedstocks are represented in REMIND
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){

plastic_CDR_SubSec <- add_dimension(plastic_CDR, dim = 3.1, add = 'secInd37', nm = 'chemicals')
out <- mbind(
Expand Down Expand Up @@ -1376,19 +1376,19 @@ if (!is.null(vm_plasticsCarbon)) {
)

# add materials-related carbon management variables only if available
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
# carbon management: flows of carbon going into materials
out <- mbind(out,

# carbon in plastics
setNames(dimSums(vm_plasticsCarbon, dim = 3) * GtC_2_MtCO2,
setNames(dimSums(v37_plasticsCarbon, dim = 3) * GtC_2_MtCO2,
"Carbon Management|Materials|+|Plastics (Mt CO2/yr)"),
# carbon in carbon fibres
#setNames(dimSums( carbonfibersVariable * GtC_2_MtCO2,
# "Carbon Management|Materials|+|Carbon fibers (Mt CO2/yr)"),
# total co2 in materials
# other materials need to be added here
setNames(dimSums(vm_plasticsCarbon, dim = 3) * GtC_2_MtCO2,
setNames(dimSums(v37_plasticsCarbon, dim = 3) * GtC_2_MtCO2,
"Carbon Management|Materials (Mt CO2/yr)")
)

Expand All @@ -1407,11 +1407,11 @@ if (!is.null(vm_plasticsCarbon)) {
# # carbon management: origin of plastics

out <- mbind(out,
setNames(dimSums(mselect(vm_plasticsCarbon, all_enty=c("seliqsyn","sesosyn","segasyn")))* GtC_2_MtCO2,
setNames(dimSums(mselect(v37_plasticsCarbon, all_enty=c("seliqsyn","sesosyn","segasyn")))* GtC_2_MtCO2,
"Carbon Management|Materials|Plastics|+|Synfuels (Mt CO2/yr)"),
setNames(dimSums(mselect(vm_plasticsCarbon, all_enty=c("seliqbio","sesobio","segabio")))* GtC_2_MtCO2,
setNames(dimSums(mselect(v37_plasticsCarbon, all_enty=c("seliqbio","sesobio","segabio")))* GtC_2_MtCO2,
"Carbon Management|Materials|Plastics|+|Biomass (Mt CO2/yr)"),
setNames(dimSums(mselect(vm_plasticsCarbon, all_enty=c("seliqfos","sesofos","segafos")))* GtC_2_MtCO2,
setNames(dimSums(mselect(v37_plasticsCarbon, all_enty=c("seliqfos","sesofos","segafos")))* GtC_2_MtCO2,
"Carbon Management|Materials|Plastics|+|Fossil (Mt CO2/yr)")
)
}
Expand Down Expand Up @@ -1707,7 +1707,7 @@ if (!is.null(vm_plasticsCarbon)) {
p_share_atmosco2[is.na(p_share_atmosco2)] <- 0

# CDR reporting if plastic-removals are considered
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
# calculate share of atmospheric and biogenic carbon contained in plastic products
p_share_atmBiogco2 <- dimSums(
( out[,,"Carbon Management|Materials|Plastics|+|Biomass (Mt CO2/yr)"]
Expand Down Expand Up @@ -1862,7 +1862,7 @@ if (!is.null(vm_plasticsCarbon)) {
## Gross emissions in Energy|Waste sector##
###########################################

if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
# calculate gross emissions in energy waste sector
out <- mbind(out,
# total gross energy waste emissions
Expand All @@ -1875,7 +1875,7 @@ if (!is.null(vm_plasticsCarbon)){
## total gross variables ##
###########################
# if feedstocks are available
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
out <- mbind(out,
# total gross energy emissions
setNames(out[, , "Emi|CO2|+|Energy (Mt CO2/yr)"]
Expand Down Expand Up @@ -2230,7 +2230,7 @@ if (!is.null(vm_plasticsCarbon)){
###############################
# note that Emi|GHG|Energy|Waste corresponds to end-of-life emissions of products of the chemicals sector
# and it is different to Emi|GHG|+++|Waste
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
out <- mbind(out,
setNames(out[, , "Emi|CO2|Energy|+|Waste (Mt CO2/yr)"],
"Emi|GHG|Energy|+|Waste (Mt CO2eq/yr)"))
Expand Down Expand Up @@ -2277,7 +2277,7 @@ if (!is.null(vm_plasticsCarbon)){

##(ecxl. negative emissions from BECCS and carbon storage of carbon-neutral synthetic fuels)
## note Emi|CO2|CDR|... variables are negative. That's why we substract them to get from net to gross emissions.
if (!is.null(vm_plasticsCarbon)){
if (!is.null(v37_plasticsCarbon)){
out <- mbind(out,

# total gross waste emissions
Expand Down Expand Up @@ -2414,7 +2414,7 @@ if (!is.null(vm_plasticsCarbon)){
###################################
## When feedstocks are available ##
###################################
if(!is.null(vm_plasticsCarbon)){
if(!is.null(v37_plasticsCarbon)){
out <- mbind(out,
# energy supply
setNames(
Expand Down Expand Up @@ -3007,7 +3007,7 @@ out <- mbind(out,


# emissions variables for which we want to calculate cumulative values
if (!is.null(vm_plasticsCarbon)) {
if (!is.null(v37_plasticsCarbon)) {
vars.cumulate <- c("Emi|GHG (Mt CO2eq/yr)",
"Emi|CO2 (Mt CO2/yr)",
"Emi|CO2|Energy and Industrial Processes (Mt CO2/yr)",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The REMIND R package (2nd generation)

R package **remind2**, version **1.135.8**
R package **remind2**, version **1.135.9**

[![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues <renato.rodrigue

To cite package **remind2** in publications use:

Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.135.8, <URL: https://github.com/pik-piam/remind2>.
Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Duerrwaechter J, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P (2024). _remind2: The REMIND R package (2nd generation)_. R package version 1.135.9, <URL: https://github.com/pik-piam/remind2>.

A BibTeX entry for LaTeX users is

Expand All @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is
title = {remind2: The REMIND R package (2nd generation)},
author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Jakob Duerrwaechter and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort and Pascal Weigmann},
year = {2024},
note = {R package version 1.135.8},
note = {R package version 1.135.9},
url = {https://github.com/pik-piam/remind2},
}
```
1 change: 1 addition & 0 deletions man/remind2-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5ebd6c3

Please sign in to comment.