Skip to content

Commit

Permalink
Merge pull request #410 from fbenke-pik/master
Browse files Browse the repository at this point in the history
calculate projected electricity from waste and other fossils
  • Loading branch information
fbenke-pik authored Jul 28, 2023
2 parents 4d6187b + dbb11ea commit 8931ef7
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '32675220'
ValidationKey: '32694786'
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 CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'mrremind: MadRat REMIND Input Data Package'
version: 0.167.0
version: 0.167.1
date-released: '2023-07-28'
abstract: The mrremind packages contains data preprocessing for the REMIND model.
authors:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: mrremind
Title: MadRat REMIND Input Data Package
Version: 0.167.0
Version: 0.167.1
Date: 2023-07-28
Authors@R: c(
person("Lavinia", "Baumstark", , "[email protected]", role = c("aut", "cre")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(calcIEA_WEO_2021)
export(calcIndustry_EEK)
export(calcIndustry_Value_Added)
export(calcODYM_RECC)
export(calcOtherFossilInElectricity)
export(calcShareIndFE)
export(calcSteelStock)
export(calcSteel_Projections)
Expand Down
68 changes: 68 additions & 0 deletions R/calcOtherFossilInElectricity.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#' Calculate projected electricity from waste and other fossils
#' using energy demands from IEA Energy Balances.
#'
#' This is used in remind2 reporting as input data to calculate additional
#' capacity and secondary energy variables.
#'
#' The projection focuses on a tight mitigation scenario and assumes that all
#' fossil emissions from waste burning / other fossil processes can be reduced
#' to 0 by 2050. Should be replaced in the future by actual modeling of waste /
#' other fossil plants, or at least connected to RCP scenario assumptions.
#'
#' @md
#' @return A list with a [`magpie`][magclass::magclass] object `x`, `weight`,
#' `unit`, `description`.
#'
#' @author Robert Pietzcker, Falk Benke
#'
#' @seealso [`calcOutput()`]
#'
#' @importFrom magclass new.magpie getItems time_interpolate magpiesort
#' @export
#'

calcOtherFossilInElectricity <- function() {
# read in data and convert from ktoe to EJ
data <- readSource("IEA", subtype = "EnergyBalances") * 4.1868e-5

el <- c("ELAUTOC", "ELAUTOE", "ELMAINC", "ELMAINE")

waste <- dimSums(data[, , el][, , c("INDWASTE", "MUNWASTEN")],
dim = 3, na.rm = TRUE
)
getItems(waste, dim = 3) <- "SE|Electricity|Other Fossil|Waste|Projected (EJ/yr)"

other <- dimSums(data[, , el][, , c(
"GASWKSGS", "COKEOVGS", "BLFURGS", "OGASES",
"REFINGAS"
)], dim = 3, na.rm = TRUE) + waste
getItems(other, dim = 3) <- "SE|Electricity|Other Fossil|Projected (EJ/yr)"

d <- mbind(waste, other)
d <- d[, 2021, , invert = TRUE]

y <- c(seq(2005, 2060, 5), seq(2070, 2100, 10), seq(2110, 2150, 20))

x.fill <- new.magpie(
cells_and_regions = getItems(d, dim = 1),
years = union(getYears(d, as.integer = TRUE), y),
names = getNames(d),
fill = 0
) %>% magpiesort()

x.fill[, getYears(d), ] <- d
x.fill[, c(2025, 2030), ] <- d[, 2020, ]
x.interpolated <- time_interpolate(x.fill[, c(2030, 2050), ], c(2035, 2040, 2045),
integrate_interpolated_years = FALSE)
x.fill[, c(2035, 2040, 2045)] <- x.interpolated

return(
list(
x = x.fill,
weight = NULL,
unit = "EJ",
description = "Projected Electricity from Waste and Other Fossils"
)
)

}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MadRat REMIND Input Data Package

R package **mrremind**, version **0.167.0**
R package **mrremind**, version **0.167.1**

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

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Lavinia Baumstark <lavinia@pik-po

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

Baumstark L, Rodrigues R, Levesque A, Oeser J, Bertram C, Mouratiadou I, Malik A, Schreyer F, Soergel B, Rottoli M, Mishra A, Dirnaichner A, Pehl M, Giannousakis A, Klein D, Strefler J, Feldhaus L, Brecha R, Rauner S, Dietrich J, Bi S, Benke F, Weigmann P, Richters O, Hasse R, Fuchs S, Mandaroux R (2023). _mrremind: MadRat REMIND Input Data Package_. R package version 0.167.0, <https://github.com/pik-piam/mrremind>.
Baumstark L, Rodrigues R, Levesque A, Oeser J, Bertram C, Mouratiadou I, Malik A, Schreyer F, Soergel B, Rottoli M, Mishra A, Dirnaichner A, Pehl M, Giannousakis A, Klein D, Strefler J, Feldhaus L, Brecha R, Rauner S, Dietrich J, Bi S, Benke F, Weigmann P, Richters O, Hasse R, Fuchs S, Mandaroux R (2023). _mrremind: MadRat REMIND Input Data Package_. R package version 0.167.1, <https://github.com/pik-piam/mrremind>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is
title = {mrremind: MadRat REMIND Input Data Package},
author = {Lavinia Baumstark and Renato Rodrigues and Antoine Levesque and Julian Oeser and Christoph Bertram and Ioanna Mouratiadou and Aman Malik and Felix Schreyer and Bjoern Soergel and Marianna Rottoli and Abhijeet Mishra and Alois Dirnaichner and Michaja Pehl and Anastasis Giannousakis and David Klein and Jessica Strefler and Lukas Feldhaus and Regina Brecha and Sebastian Rauner and Jan Philipp Dietrich and Stephen Bi and Falk Benke and Pascal Weigmann and Oliver Richters and Robin Hasse and Sophie Fuchs and Rahel Mandaroux},
year = {2023},
note = {R package version 0.167.0},
note = {R package version 0.167.1},
url = {https://github.com/pik-piam/mrremind},
}
```
29 changes: 29 additions & 0 deletions man/calcOtherFossilInElectricity.Rd

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

0 comments on commit 8931ef7

Please sign in to comment.