Skip to content

Commit

Permalink
Near-term increase of electricity demand CHA buildings
Browse files Browse the repository at this point in the history
  • Loading branch information
robinhasse committed Feb 21, 2025
1 parent ac623ea commit 66113e5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '43903020'
ValidationKey: '43925340'
AcceptedWarnings:
- Invalid URL: .*
- 'Warning: package ''.*'' was built under R version'
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: 'mrremind: MadRat REMIND Input Data Package'
version: 0.218.0
date-released: '2025-02-20'
version: 0.218.1
date-released: '2025-02-21'
abstract: The mrremind packages contains data preprocessing for the REMIND model.
authors:
- family-names: Baumstark
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: mrremind
Title: MadRat REMIND Input Data Package
Version: 0.218.0
Date: 2025-02-20
Version: 0.218.1
Date: 2025-02-21
Authors@R: c(
person("Lavinia", "Baumstark", , "[email protected]", role = c("aut", "cre")),
person("Renato", "Rodrigues", role = "aut"),
Expand Down
25 changes: 21 additions & 4 deletions R/convertStationary.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ convertStationary <- function(x) {
}

# Select last year of X available in the historical data set
maxYear_X_in_FE <- max(getYears(x, as.integer = TRUE)[getYears(x, as.integer = TRUE) %in%
getYears(wfe, as.integer = TRUE)])
maxYear_X_in_FE <- max(intersect(getYears(x, as.integer = TRUE),
getYears(wfe, as.integer = TRUE)))
# Deduce the scenario periods
exceeding_years <- getYears(x, as.integer = TRUE)[getYears(x, as.integer = TRUE) > maxYear_X_in_FE]

Expand All @@ -102,11 +102,19 @@ convertStationary <- function(x) {
# before the FE_stationary projections are fully taken up

# The years exceeding maxYear might not be meaningful. Therefore we exclude them
helper <- getYears(hist_fe_stationary)[getYears(hist_fe_stationary, TRUE) <= maxYear_X_in_FE]
fe_stationary <- time_interpolate(hist_fe_stationary[, helper, ],
yearsWithData <- getYears(hist_fe_stationary)[getYears(hist_fe_stationary, TRUE) <= maxYear_X_in_FE]
fe_stationary <- time_interpolate(hist_fe_stationary[, yearsWithData, ],
interpolated_year = c(maxYear_X_in_FE, exceeding_years),
integrate_interpolated_years = TRUE,
extrapolation_type = "constant")

# TODO: remove this hot fix
# We add 2 EJ/yr of unspecified electric demand allocated to buildings
# to future years to lift up the final 2025 point by this amount.
iFix <- "feothelec"
fe_stationary["CHN", exceeding_years, iFix] <- fe_stationary["CHN", exceeding_years, iFix] + 2
xFix <- x["CHN", , iFix]

fe_stationary <- addSSPnames(fe_stationary)

# change the regional resolution of fe_stationary to match the EDGE_stationary resolution
Expand All @@ -127,6 +135,15 @@ convertStationary <- function(x) {
x[, , stationary_items] <- fe_stationary[, getYears(x), stationary_items] * (1 - lambda) +
x[, , stationary_items] * lambda

# TODO: remove this hot fix
# shift transition by one time step to maintain the +2EJ we added and stretch
# it to smooth the peak a bit
lambdaFix <- calcLambda(setdiff(exceeding_years, 2025), 2055,
getYears(x)[getYears(x, TRUE) <= min(exceeding_years)])
x["CHN", , iFix] <- fe_stationary["CHN", getYears(x), iFix] * (1 - lambdaFix) +
xFix * lambdaFix


# Scale GDP and FE weights so that they can be added
wg <- wg / dimSums(wg, dim = 1, na.rm = TRUE)
wfe <- wfe / dimSums(wfe, dim = 1, na.rm = TRUE)
Expand Down
8 changes: 4 additions & 4 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.218.0**
R package **mrremind**, version **0.218.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,17 +39,17 @@ 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, Koch J (2025). "mrremind: MadRat REMIND Input Data Package." Version: 0.218.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, Koch J (2025). "mrremind: MadRat REMIND Input Data Package." Version: 0.218.1, <https://github.com/pik-piam/mrremind>.

A BibTeX entry for LaTeX users is

```latex
@Misc{,
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 and Johannes Koch},
date = {2025-02-20},
date = {2025-02-21},
year = {2025},
url = {https://github.com/pik-piam/mrremind},
note = {Version: 0.218.0},
note = {Version: 0.218.1},
}
```

0 comments on commit 66113e5

Please sign in to comment.