Skip to content

Commit

Permalink
fix backward compatibility for project reporting again and buildLibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
mellamoSimon committed Feb 14, 2024
1 parent 6735d1d commit 550de73
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '224202816'
ValidationKey: '224256615'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9025
rev: v0.4.0
hooks:
- id: parsable-R
- id: deps-in-desc
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.134.4
date-released: '2024-02-11'
version: 1.134.5
date-released: '2024-02-14'
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.134.4
Date: 2024-02-11
Version: 1.134.5
Date: 2024-02-14
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
105 changes: 103 additions & 2 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,6 @@ if (!is.null(vm_plasticsCarbon)) {
# deduce co2 captured by industrial processes which is not stored but used for CCU (synfuels)
# -> gets accounted in industrial process emissions
- vm_emiIndCCS[, , "co2cement_process"]*(1-p_share_CCS)
# fixme: missing/wrong emissions
) * GtC_2_MtCO2,
"Emi|CO2|+|Energy (Mt CO2/yr)"))

Expand Down Expand Up @@ -1882,7 +1881,7 @@ if (!is.null(vm_plasticsCarbon)) {
###########################################
## Gross emissions in Energy|Waste sector##
###########################################
# fixme: check that CDR addition makes sense

if (!is.null(vm_plasticsCarbon)){
# calculate gross emissions in energy waste sector
out <- mbind(out,
Expand Down Expand Up @@ -2431,6 +2430,11 @@ if (!is.null(vm_plasticsCarbon)){
"Emi|N2O|++|Outside ETS and ESR (kt N2O/yr)"))

# market GHG emissions across sectors

###################################
## When feedstocks are available ##
###################################
if(!is.null(vm_plasticsCarbon)){
out <- mbind(out,
# energy supply
setNames(
Expand Down Expand Up @@ -2533,6 +2537,103 @@ if (!is.null(vm_plasticsCarbon)){
"Emi|GHG|Outside ETS and ESR|+|F-Gases (Mt CO2eq/yr)")

)
}else{
#######################################
## When feedstocks are not available ##
#######################################
out <- mbind(out,
# energy supply
setNames(
out[, , "Emi|CO2|Energy|+|Supply (Mt CO2/yr)"]
+ out[, , "Emi|GHG|CH4|+|Energy Supply (Mt CO2eq/yr)"]
+ out[, , "Emi|GHG|N2O|+|Energy Supply (Mt CO2eq/yr)"],
"Emi|GHG|ETS|+|Energy Supply (Mt CO2eq/yr)"),

# industry (energy and process emissions)
setNames(
# demand-side co2 emissions (before industry CCS)
(dimSums(mselect(EmiFeCarrier[, , "ETS"], emi_sectors = "indst"), dim = 3)
# industry CCS
# TODO: adapt to industry ETS/ESR split
- dimSums(vm_emiIndCCS[, , emiInd37_fuel]*p_share_CCS, dim=3)
# substract synthetic and biogenic carbon contained in non-incinerated plastics
- dimSums(plastic_CDR, dim=3)
# add captured CO2 from cement process which is not stored
# (EmiMACEq for co2cement_process contains cement process emissions - captured cement co2 process emissions)
+ vm_emiIndCCS[, , "co2cement_process"]*(1-p_share_CCS)) * GtC_2_MtCO2
+ dimSums(mselect(EmiMACEq[, , "ETS"], sector = "indst"), dim = 3)
# add chemical process emissions to ETS
+ dimSums(EmiProcess_Feedstocks, dim = 3) * GtC_2_MtCO2,
"Emi|GHG|ETS|+|Industry (Mt CO2eq/yr)"),
setNames(
# demand-side co2 emissions (before industry CCS)
dimSums(mselect(EmiFeCarrier[, , "ES"], emi_sectors = "indst"), dim = 3) * GtC_2_MtCO2,
"Emi|GHG|ESR|+|Industry (Mt CO2eq/yr)"),

# Transport
setNames(
# demand-side co2 emissions (ETS)
(dimSums(mselect(EmiFeCarrier[, , "ETS"], emi_sectors = "trans"), dim = 3)) * GtC_2_MtCO2,
"Emi|GHG|ETS|+|Transport (Mt CO2eq/yr)"),

setNames(
# demand-side co2 emissions (ESR)
dimSums(mselect(EmiFeCarrier[, , "ES"], emi_sectors = "trans"), dim = 3) * GtC_2_MtCO2
+ dimSums(mselect(EmiMACEq[, , "ES"], sector = "trans"), dim = 3),
"Emi|GHG|ESR|+|Transport (Mt CO2eq/yr)"),

setNames(
# demand-side co2 emissions (bunkers)
dimSums(mselect(EmiFeCarrier[, , "other"], emi_sectors = "trans"), dim = 3) * GtC_2_MtCO2,
"Emi|GHG|Outside ETS and ESR|+|Transport (Mt CO2eq/yr)"),

# Buildings
setNames(
# demand-side co2 emissions
dimSums(mselect(EmiFeCarrier[, , "ES"], emi_sectors = "build"), dim = 3) * GtC_2_MtCO2,
"Emi|GHG|ESR|+|Buildings (Mt CO2eq/yr)"),

# CDR
setNames(
# demand-side co2 emissions (before industry CCS)
# CDR energy-related emissions
(dimSums(mselect(EmiFeCarrier[, , "ETS"], emi_sectors = "CDR"), dim = 3)
# Captured CO2 by non-BECCS capture technologies
+ (vm_emiCdrTeDetail[, , "weathering"] + vm_emiCdrTeDetail[, , "dac"] * p_share_CCS)) * GtC_2_MtCO2,
"Emi|GHG|ETS|+|non-BECCS CDR (Mt CO2eq/yr)"),

# Extraction
setNames(
out[, , "Emi|GHG|CH4|+|Extraction (Mt CO2eq/yr)"],
"Emi|GHG|ETS|+|Extraction (Mt CO2eq/yr)"),

# Agriculture
setNames(
out[, , "Emi|GHG|CH4|+|Agriculture (Mt CO2eq/yr)"]
+ out[, , "Emi|GHG|N2O|+|Agriculture (Mt CO2eq/yr)"],
"Emi|GHG|ESR|+|Agriculture (Mt CO2eq/yr)"),

# Waste (from MAC curve)
setNames(
dimSums(mselect(EmiMACEq[, , "ETS"], sector = "Waste"), dim = 3) ,
"Emi|GHG|ETS|+|Waste (Mt CO2eq/yr)"),
setNames(
dimSums(mselect(EmiMACEq[, , "ES"], sector = "Waste"), dim = 3),
"Emi|GHG|ESR|+|Waste (Mt CO2eq/yr)"),

setNames(
out[, , "Emi|GHG|N2O|+|Land-Use Change (Mt CO2eq/yr)"]
+ out[, , "Emi|GHG|CH4|+|Land-Use Change (Mt CO2eq/yr)"]
+ out[, , "Emi|CO2|+|Land-Use Change (Mt CO2/yr)"],
"Emi|GHG|Outside ETS and ESR|+|Land-Use Change (Mt CO2eq/yr)"),

# F-Gases
setNames(
out[, , "Emi|GHG|+|F-Gases (Mt CO2eq/yr)"],
"Emi|GHG|Outside ETS and ESR|+|F-Gases (Mt CO2eq/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.134.4**
R package **remind2**, version **1.134.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, 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.134.4, <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.134.5, <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.134.4},
note = {R package version 1.134.5},
url = {https://github.com/pik-piam/remind2},
}
```

0 comments on commit 550de73

Please sign in to comment.