Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pik-piam/remind2 into pbs
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobBD committed Jan 18, 2024
2 parents ae30c65 + 0c29cc9 commit 284d910
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '222762990'
ValidationKey: '222856062'
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.129.0
date-released: '2024-01-09'
version: 1.129.3
date-released: '2024-01-12'
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.129.0
Date: 2024-01-09
Version: 1.129.3
Date: 2024-01-12
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
3 changes: 1 addition & 2 deletions R/remind2-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
#'
#' @name remind2-package
#' @aliases remind2-package remind2
#' @docType package
NULL
"_PACKAGE"
22 changes: 11 additions & 11 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200
# total captured CO2
vm_co2capture <- readGDX(gdx, "vm_co2capture", field = "l", restore_zeros = F)[, t, ]

v33_emi <- readGDX(gdx, "v33_emi", field = "l", restore_zeros = F, react = "silent")[, t, ]
vm_emiCdrTeDetail <- readGDX(gdx, c("vm_emiCdrTeDetail","v33_emi"), field = "l", restore_zeros = F, react = "silent")[, t, ]

if (is.null(v33_emi)) { # compatibility with the CDR module before the portfolio was added
if (is.null(vm_emiCdrTeDetail)) { # compatibility with the CDR module before the portfolio was added
# captured CO2 by DAC
v33_emiDAC <- readGDX(gdx, "v33_emiDAC", field = "l", restore_zeros = F, react = "silent")[, t, ]
if (is.null(v33_emiDAC)) {
Expand All @@ -187,8 +187,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200
v33_emiEW <- new.magpie(getItems(vm_co2capture, "all_regi"), getItems(vm_co2capture, "ttot"), fill = 0)
}
# variable used in the rest of the reporting
v33_emi <- mbind(v33_emiDAC, v33_emiEW)
v33_emi <- setNames(v33_emi, c("dac", "weathering"))
vm_emiCdrTeDetail <- mbind(v33_emiDAC, v33_emiEW)
vm_emiCdrTeDetail <- setNames(vm_emiCdrTeDetail, c("dac", "weathering"))
}
# stored CO2
vm_co2CCS <- readGDX(gdx, "vm_co2CCS", field = "l", restore_zeros = F)[, t, ]
Expand Down Expand Up @@ -1114,7 +1114,7 @@ if (!is.null(vm_plasticsCarbon)) {
# vm_emiTeMkt is variable in REMIND closest to energy co2 emissions
(dimSums(sel_vm_emiTeMkt_co2, dim = 3)
# subtract non-BECCS CCU CO2 (i.e., non-CCS part of DAC)
- (1 - p_share_CCS) * (-v33_emi[, , "dac"])
- (1 - p_share_CCS) * (-vm_emiCdrTeDetail[, , "dac"])
# deduce co2 captured by industrial processes which is not stored but used for CCU
# -> gets accounted in industrial process emissions
- vm_emiIndCCS[, , "co2cement_process"]*(1-p_share_CCS)) * GtC_2_MtCO2,
Expand Down Expand Up @@ -1164,7 +1164,7 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(dimSums(vm_emiMacSector[, , "co2luc"], dim = 3) * GtC_2_MtCO2,
"Emi|CO2|+|Land-Use Change (Mt CO2/yr)"),
# negative emissions from (non-BECCS) CDR (DACCS, EW)
setNames((v33_emi[, , "weathering"] + v33_emi[, , "dac"] * p_share_CCS) * GtC_2_MtCO2,
setNames((vm_emiCdrTeDetail[, , "weathering"] + vm_emiCdrTeDetail[, , "dac"] * p_share_CCS) * GtC_2_MtCO2,
"Emi|CO2|+|non-BECCS CDR (Mt CO2/yr)")
)

Expand Down Expand Up @@ -1197,7 +1197,7 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(dimSums(vm_emiMacSector[, , "co2luc"], dim = 3) * GtC_2_MtCO2,
"Emi|CO2|+|Land-Use Change (Mt CO2/yr)"),
# negative emissions from (non-BECCS) CDR (DACCS, EW)
setNames((v33_emi[, , "weathering"] + v33_emi[, , "dac"] * p_share_CCS) * GtC_2_MtCO2,
setNames((vm_emiCdrTeDetail[, , "weathering"] + vm_emiCdrTeDetail[, , "dac"] * p_share_CCS) * GtC_2_MtCO2,
"Emi|CO2|+|non-BECCS CDR (Mt CO2/yr)")
)

Expand Down Expand Up @@ -1385,7 +1385,7 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(dimSums(vm_emiIndCCS[, , "co2cement_process"], dim = 3) * GtC_2_MtCO2,
"Carbon Management|Carbon Capture|Industry Process|+|Cement (Mt CO2/yr)"),
# total co2 captured by DAC
setNames(-v33_emi[, , "dac"] * GtC_2_MtCO2,
setNames(-vm_emiCdrTeDetail[, , "dac"] * GtC_2_MtCO2,
"Carbon Management|Carbon Capture|+|DAC (Mt CO2/yr)"),
# total co2 captured
setNames(vm_co2capture * GtC_2_MtCO2,
Expand Down Expand Up @@ -1748,7 +1748,7 @@ if (!is.null(vm_plasticsCarbon)) {
"Emi|CO2|CDR|DACCS (Mt CO2/yr)"),
# total EW
# total co2 captured by EW
setNames(v33_emi[, , "weathering"] * GtC_2_MtCO2,
setNames(vm_emiCdrTeDetail[, , "weathering"] * GtC_2_MtCO2,
"Emi|CO2|CDR|EW (Mt CO2/yr)"))

out <- mbind(out,
Expand Down Expand Up @@ -1787,7 +1787,7 @@ if (!is.null(vm_plasticsCarbon)) {
"Emi|CO2|CDR|DACCS (Mt CO2/yr)"),
# total EW
# total co2 captured by EW
setNames(v33_emi[, , "weathering"] * GtC_2_MtCO2,
setNames(vm_emiCdrTeDetail[, , "weathering"] * GtC_2_MtCO2,
"Emi|CO2|CDR|EW (Mt CO2/yr)"))

out <- mbind(out,
Expand Down Expand Up @@ -2401,7 +2401,7 @@ if (!is.null(vm_plasticsCarbon)) {
# CDR energy-related emissions
(dimSums(mselect(EmiFeCarrier[, , "ETS"], emi_sectors = "CDR"), dim = 3)
# Captured CO2 by non-BECCS capture technologies
+ (v33_emi[, , "weathering"] + v33_emi[, , "dac"] * p_share_CCS)) * GtC_2_MtCO2,
+ (vm_emiCdrTeDetail[, , "weathering"] + vm_emiCdrTeDetail[, , "dac"] * p_share_CCS)) * GtC_2_MtCO2,
"Emi|GHG|ETS|+|non-BECCS CDR (Mt CO2eq/yr)"),

# Extraction
Expand Down
8 changes: 4 additions & 4 deletions R/reportLCOE.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ reportLCOE <- function(gdx, output.type = "both"){
p47_taxCO2eq_AggFE <- readGDX(gdx,"p47_taxCO2eq_AggFE", restore_zeros=F, react = "silent")

## variables
v_costInvTeDir <- readGDX(gdx,name=c("v_costInvTeDir","vm_costInvTeDir","v_directteinv"),field="l",format="first_found")[,ttot,] ## Total direct Investment Cost in Timestep
v_costInvTeAdj <- readGDX(gdx,name=c("v_costInvTeAdj"),field="l",format="first_found")[,ttot,] ## total adjustment cost in period
vm_costInvTeDir <- readGDX(gdx,name=c("vm_costInvTeDir","v_costInvTeDir","v_directteinv"),field="l",format="first_found")[,ttot,] ## Total direct Investment Cost in Timestep
vm_costInvTeAdj <- readGDX(gdx,name=c("vm_costInvTeAdj","v_costInvTeAdj"),field="l",format="first_found")[,ttot,] ## total adjustment cost in period
vm_capEarlyReti <- readGDX(gdx,name=c("vm_capEarlyReti"),field="l",format="first_found")[,ttot,]
vm_deltaCap <- readGDX(gdx,name=c("vm_deltaCap"),field="l",format="first_found")[,ttot,]
vm_demPe <- readGDX(gdx,name=c("vm_demPe","v_pedem"),field="l",restore_zeros=FALSE,format="first_found")
Expand Down Expand Up @@ -174,13 +174,13 @@ reportLCOE <- function(gdx, output.type = "both"){
te_inv_annuity <- 1e+12 * te_annuity[,,te] *
mbind(
v_investcost[,ttot_before2005,te] * dimSums(vm_deltaCap[teall2rlf][,ttot_before2005,te],dim=3.2),
v_costInvTeDir[,ttot_from2005,te]
vm_costInvTeDir[,ttot_from2005,te]
)

te_inv_annuity_wadj <- 1e+12 * te_annuity[,,te] *
mbind(
v_investcost[,ttot_before2005,te] * dimSums(vm_deltaCap[teall2rlf][,ttot_before2005,te],dim=3.2),
v_costInvTeAdj[,ttot_from2005,te] + v_costInvTeDir[,ttot_from2005,te]
vm_costInvTeAdj[,ttot_from2005,te] + vm_costInvTeDir[,ttot_from2005,te]
)

# average LCOE components ----
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.129.0**
R package **remind2**, version **1.129.3**

[![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, 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.129.0, <https://github.com/pik-piam/remind2>.
Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, 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.129.3, <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 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.129.0},
note = {R package version 1.129.3},
url = {https://github.com/pik-piam/remind2},
}
```

0 comments on commit 284d910

Please sign in to comment.