Skip to content

Commit

Permalink
Merge pull request #452 from fschreyer/EmiReport
Browse files Browse the repository at this point in the history
fix calculation of gross emissions in GHG emissions variables and complete emissions barplots in cs2 summary part
  • Loading branch information
fschreyer authored Sep 12, 2023
2 parents f46fec1 + ba3bd87 commit 16a72e5
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '219133314'
ValidationKey: '219164100'
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.117.4
date-released: '2023-09-11'
version: 1.117.5
date-released: '2023-09-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.117.4
Date: 2023-09-11
Version: 1.117.5
Date: 2023-09-12
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
37 changes: 23 additions & 14 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -1425,15 +1425,22 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200



## 4. Gross Emissions (excl. negative emissions from BECCS) ----
## 4. Gross Emissions (excl. negative emissions from storing non-fossil carbon from bioenergy or synthetic fuels) ----

#### calculate gross emissions

# all standard emissions variables "Emi|CO2|..." are defined as net emissions.
# This means that negative emissions are counted in and have to be subtracted to obtain gross emissions.

# calculate gross emissions in energy supply sector (i.e. subtracting contribution from supply side BECCS)
# using the respective "Carbon Management|Storage" variables as we don't have the necessary level of detail in the "Emi|CO2|CDR" variables
# All standard emissions variables "Emi|CO2|..." are defined as net emissions, that is, including negative emissions from CDR technologies.
# We define gross emissions as net emissions plus CDR flows from capturing carbon from non-fossil energy flows. That includes carbon from biomass and
# synfuels from non-fossil (biomass or DAC) origin.
# Note: With the current definition of gross emissions (only including non-fossil CCS) and our current emissions accounting convention of CCU that
# accounts carbon in synthetic fuels with the CO2 provider, gross industry emissions (Emi|CO2|Gross|Energy|Demand|+|Industry)
# can become negative under certain circumstances. This reason is: Using synthetic fuels is always accounted as emissions-free for the industry sector
# regardless of whether the carbon of the synfuels comes from fossil or non-fossil origin. Moreover, carbon from all origins (non-fossil and fossil) is subtracted
# from the industry emissions in case industry CCS is applied to those emissions. However, the variable Emi|CO2|CDR|Industry CCS|Synthetic Fuels
# used to calculate the gross industry emissions only contains the carbon from non-fossil synfuels, though. This is following the principle
# that only non-fossil carbon should be accounted as CDR variables as only non-fossil removals are negative emissions from a full-system perspective.
# So, the carbon from fossil-based synfuels which is captured and stored in industry is still accounted as negative emissions for industry
# in Emi|CO2|Gross|Energy|Demand|+|Industry. The corresponding fossil emissions are accounted with the sector that captured the fossil CO2 in the first place.
out <- mbind(out,
# gross supply emissions across SE carriers
setNames(out[, , "Emi|CO2|Energy|Supply|+|Electricity w/ couple prod (Mt CO2/yr)"]
Expand Down Expand Up @@ -1811,23 +1818,24 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200


## gross GHG variables (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.
out <- mbind(out,

# total gross supply emissions
setNames(out[, , "Emi|GHG|Energy|+|Supply (Mt CO2eq/yr)"]
+ out[, , "Carbon Management|Storage|+|Biomass|Pe2Se (Mt CO2/yr)"],
- out[, , "Emi|CO2|CDR|BECCS|Pe2Se (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy|+|Supply (Mt CO2eq/yr)"),


# total gross demand emissions
setNames(out[, , "Emi|GHG|Energy|+|Demand (Mt CO2eq/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Biomass (Mt CO2/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Synfuel (Mt CO2/yr)"],
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS|Industry (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy|+|Demand (Mt CO2eq/yr)"),

setNames(out[, , "Emi|GHG|Energy|Demand|+|Industry (Mt CO2eq/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Biomass (Mt CO2/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Synfuel (Mt CO2/yr)"],
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS|Industry (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy|Demand|+|Industry (Mt CO2eq/yr)"),


Expand All @@ -1844,9 +1852,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

# total gross energy emissions
setNames(out[, , "Emi|GHG|+++|Energy (Mt CO2eq/yr)"]
+ out[, , "Carbon Management|Storage|+|Biomass|Pe2Se (Mt CO2/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Biomass (Mt CO2/yr)"]
+ out[, , "Carbon Management|Storage|Industry Energy|+|Synfuel (Mt CO2/yr)"],
- out[, , "Emi|CO2|CDR|Industry CCS|Synthetic Fuels (Mt CO2/yr)"]
- out[, , "Emi|CO2|CDR|BECCS (Mt CO2/yr)"],
"Emi|GHG|Gross|Energy (Mt CO2eq/yr)")


Expand Down Expand Up @@ -2451,6 +2458,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200
"Emi|CO2|Energy|Demand|+|Transport (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|Industry (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|Buildings (Mt CO2/yr)",
"Emi|CO2|Energy|Demand|+|CDR (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Demand|+|Industry (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Supply|Non-electric (Mt CO2/yr)",
"Emi|CO2|Gross|Energy|Supply|+|Electricity (Mt CO2/yr)",
"Emi|CO2|CDR (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.117.4**
R package **remind2**, version **1.117.5**

[![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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.117.4, <URL: 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.117.5, <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},
year = {2023},
note = {R package version 1.117.4},
note = {R package version 1.117.5},
url = {https://github.com/pik-piam/remind2},
}
```
12 changes: 8 additions & 4 deletions inst/markdown/compareScenarios2/cs2_01_summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ items <- c(
showAreaAndBarPlots(data, items, tot, scales = "fixed")
```

## GHG by sector (w/ gross emissions, excl. BECCS)
## GHG by sector (w/ gross emissions, excl. negative emissions from CCS of non-fossil carbon)

```{r summary GHG by sector}
tot <- "Emi|GHG"
Expand All @@ -27,6 +27,7 @@ items <- c(
"Emi|GHG|Energy|Demand|Transport",
"Emi|GHG|Energy|Demand|Buildings",
"Emi|GHG|Gross|Energy|Demand|Industry",
"Emi|GHG|Energy|Demand|CDR",
"Emi|GHG|Industrial Processes",
"Emi|GHG|Agriculture",
"Emi|GHG|Land-Use Change",
Expand All @@ -44,7 +45,7 @@ showAreaAndBarPlots(data, items, tot, scales = "fixed")
showAreaAndBarPlots(data, paste(items, "pCap"), paste(tot, "pCap"), scales = "fixed")
```

## CO2 by sector (w/ gross emissions, excl. BECCS)
## CO2 by sector (w/ gross emissions, excl. negative emissions from CCS of non-fossil carbon)

```{r CO2 by sector}
tot <- "Emi|CO2"
Expand All @@ -54,6 +55,7 @@ items <- c(
"Emi|CO2|Energy|Demand|Transport",
"Emi|CO2|Gross|Energy|Demand|Industry",
"Emi|CO2|Energy|Demand|Buildings",
"Emi|CO2|Energy|Demand|CDR",
"Emi|CO2|Gross|Energy|Supply|Non-electric",
"Emi|CO2|Gross|Energy|Supply|Electricity",
"Emi|CO2|CDR|BECCS",
Expand All @@ -70,19 +72,21 @@ showAreaAndBarPlots(data, paste(items, "pCap"), paste(tot, "pCap"), scales = "fi
```


### CO2 cumulated by sector
### CO2 cumulated by sector (w/ gross emissions, excl. negative emissions from CCS of non-fossil carbon)

```{r CO2 cumulated by sector}
tot <- "Emi|CO2|Cumulated"
items <- c(
"Emi|CO2|Cumulated|Land-Use Change",
"Emi|CO2|Cumulated|Industrial Processes",
"Emi|CO2|Cumulated|Energy|Demand|Transport",
"Emi|CO2|Cumulated|Energy|Demand|Industry",
"Emi|CO2|Cumulated|Gross|Energy|Demand|Industry",
"Emi|CO2|Cumulated|Energy|Demand|Buildings",
"Emi|CO2|Cumulated|Energy|Demand|CDR",
"Emi|CO2|Cumulated|Gross|Energy|Supply|Non-electric",
"Emi|CO2|Cumulated|Gross|Energy|Supply|Electricity",
"Emi|CO2|Cumulated|CDR|BECCS",
"Emi|CO2|Cumulated|CDR|Industry CCS|Synthetic Fuels",
"Emi|CO2|Cumulated|CDR|DACCS",
"Emi|CO2|Cumulated|CDR|EW")
showAreaAndBarPlots(data, items, tot, scales = "fixed")
Expand Down

0 comments on commit 16a72e5

Please sign in to comment.