Skip to content

Commit

Permalink
Merge pull request #501 from fbenke-pik/master
Browse files Browse the repository at this point in the history
fix errors and warnings in reportEmi
  • Loading branch information
fbenke-pik authored Jan 4, 2024
2 parents 09b72be + 8593f4a commit ff50a96
Show file tree
Hide file tree
Showing 7 changed files with 22 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: '222283680'
ValidationKey: '222529006'
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.128.0
date-released: '2023-12-15'
version: 1.128.1
date-released: '2024-01-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.128.0
Date: 2023-12-15
Version: 1.128.1
Date: 2024-01-04
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
26 changes: 11 additions & 15 deletions R/reportEmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param t temporal resolution of the reporting, default:
#' t=c(seq(2005,2060,5),seq(2070,2110,10),2130,2150)
#'
#' @author Felix Schreyer...
#' @author Felix Schreyer, Simón Moreno Leiva
#' @examples
#' \dontrun{
#' reportEmi(gdx)
Expand All @@ -27,7 +27,6 @@

reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(2005, 2060, 5), seq(2070, 2110, 10), 2130, 2150)) {


# emissions calculation requires information from other reporting functions
if (is.null(output)) {
message("reportEmi executes reportFE")
Expand Down Expand Up @@ -308,8 +307,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

# get combinations of SE,FE,sector,emiMkt that exist in vm_demFeSector
FE.map <- se2fe %>%
left_join(entyFe2Sector) %>%
left_join(sector2emiMkt) %>%
left_join(entyFe2Sector, by = "all_enty1", relationship = "many-to-many") %>%
left_join(sector2emiMkt, by = "emi_sectors", relationship = "many-to-many") %>%
select( -all_te) %>%
mutate( name = paste(all_enty,all_enty1,emi_sectors,all_emiMkt, sep = "."))

Expand Down Expand Up @@ -345,8 +344,8 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200

# get combinations of SE,FE,sector,emiMkt that exist in vm_nonIncineratedPlastics
FE.feed.map <- se2fe %>%
left_join(entyFe2Sector) %>%
left_join(sector2emiMkt) %>%
left_join(entyFe2Sector, by = "all_enty1", relationship = "many-to-many") %>%
left_join(sector2emiMkt, by = "emi_sectors", relationship = "many-to-many") %>%
right_join(entyFe2sector2emiMkt_NonEn %>%
rename(all_enty1 = all_enty)) %>%
select( -all_te) %>%
Expand Down Expand Up @@ -498,7 +497,7 @@ reportEmi <- function(gdx, output = NULL, regionSubsetList = NULL, t = c(seq(200
- dimSums(plastic_CDR, dim=3)
)*GtC_2_MtCO2,
"Emi|CO2|Energy|+|Demand (Mt CO2/yr)")

)

# CO2 emissions from the end-of-life of carbon-bearing products
Expand All @@ -513,7 +512,7 @@ if (!is.null(vm_plasticsCarbon)) {
setNames(out[, , "Emi|CO2|Energy|Waste|+|Feedstocks unknown fate (Mt CO2/yr)"]
+ out[, , "Emi|CO2|Energy|Waste|+|Plastics Incineration (Mt CO2/yr)"],
"Emi|CO2|Energy|+|Waste (Mt CO2/yr)")
)
)
}
#### 2.1.2 Energy Supply ----

Expand Down Expand Up @@ -854,7 +853,7 @@ if (!is.null(vm_plasticsCarbon)) {
x[['variable']])
}) %>%
mbind())

# Baseline emission before CCS, corresponds to energy carbon content
out <- mbind(
# energy emissions
Expand Down Expand Up @@ -2536,10 +2535,9 @@ if (!is.null(vm_plasticsCarbon)) {

# 8. Ad-hoc fix for emissions w/o non-energy use and Aggregation to global and regional values ----

if (is.null(vm_demFENonEnergySector) && (module2realisation["industry", 2] == "fixed_shares")) {
# (Note: The non-energy use variables are so far only available for REMIND-EU runs and industry fixed_shares)

# (Note: The non-energy use variables are so far only available for REMIND-EU runs and industry fixed_shares)
# TODO: add non-energy use variables for all regionmappings and sector realizations
#Note (SM): I'm not sure if I got these notes so I created the condition above to try to make sure that this will work anyways

# Note: Non-energy use emissions should not be confused with process emissions. Non-energy use emissions are emissions/carbon flow of FE carriers which are used as feedstocks in industry.
if ("FE|Non-energy Use|Industry (EJ/yr)" %in% getNames(output) &&
Expand Down Expand Up @@ -2659,12 +2657,10 @@ if (is.null(vm_demFENonEnergySector) && (module2realisation["industry", 2] == "f
# insert "w/o Non-energy Use" label in variable names
out.wNonEn <- setNames(out.wNonEn[, , emi.vars.wNonEn], names.wNonEn)


out <- mbind(out, out.wNonEn)


}
}

# add global values
out <- mbind(out, dimSums(out, dim = 1))
# add other region aggregations
Expand Down
8 changes: 4 additions & 4 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.128.0**
R package **remind2**, version **1.128.1**

[![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,16 +49,16 @@ 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.128.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.128.1, <https://github.com/pik-piam/remind2>.

A BibTeX entry for LaTeX users is

```latex
@Manual{,
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 = {2023},
note = {R package version 1.128.0},
year = {2024},
note = {R package version 1.128.1},
url = {https://github.com/pik-piam/remind2},
}
```
2 changes: 1 addition & 1 deletion man/reportEmi.Rd

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

2 changes: 1 addition & 1 deletion man/reportFE.Rd

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

0 comments on commit ff50a96

Please sign in to comment.