Skip to content

Commit

Permalink
Merge pull request pik-piam#588 from fbenke-pik/ageb
Browse files Browse the repository at this point in the history
update AGEB data to 2023
  • Loading branch information
fbenke-pik authored Nov 13, 2024
2 parents 7bda03f + e3b255d commit 3da87d3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '39529055'
ValidationKey: '39558960'
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.197.3
date-released: '2024-11-08'
version: 0.197.4
date-released: '2024-11-13'
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.197.3
Date: 2024-11-08
Version: 0.197.4
Date: 2024-11-13
Authors@R: c(
person("Lavinia", "Baumstark", , "[email protected]", role = c("aut", "cre")),
person("Renato", "Rodrigues", role = "aut"),
Expand Down
27 changes: 14 additions & 13 deletions R/readAGEB.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#'
#' @author Falk Benke
#'
#' @param subtype data subtype. Either "balances" ("Auswertungstabellen zur Energiebilanz Deutschland") or "electricity" ("Bruttostromerzeugung in Deutschland nach Energieträgern")
#' @param subtype data subtype. Either "balances" ("Auswertungstabellen zur Energiebilanz Deutschland")
#' or "electricity" ("Bruttostromerzeugung in Deutschland nach Energietraegern")
#' @importFrom readxl read_xlsx
#' @importFrom tibble tibble
#' @importFrom dplyr bind_rows select filter mutate
Expand Down Expand Up @@ -38,7 +39,7 @@ readAGEB <- function(subtype = "balances") {
"4.1 Einsatz von Energietraegern zur Stromerzeugung",
"4.2 Einsatz von Energietraegern zur Fernwaermeerzeugung",
"6.1 Endenergieverbrauch nach Energietraegern",
"6.2 Endenergieverbrauch Bergbau, Gewinnung von Steinen und Erden und Verarbeitendes Gewerbe nach Energietraegern",
"6.2 Endenergieverbrauch Bergbau, Gewinnung von Steinen und Erden und Verarbeitendes Gewerbe nach Energietraegern", #nolint
"6.3 Endenergieverbrauch Private Haushalte nach Energietraegern",
"6.4 Endenergieverbrauch Gewerbe, Handel, Dienstleistungen (GHD) nach Energietraegern",
"6.5 Endenergieverbrauch Landwirtschaft, Fischerei, Bauwirtschaft nach Energietraegern",
Expand All @@ -47,21 +48,21 @@ readAGEB <- function(subtype = "balances") {
"6.8 Endenergieverbrauch im Subsektor Strassenverkehr nach Energietraegern"
),
range = c(
"B4:AJ13", "B4:AJ15", "B4:AJ15", "B4:AJ15", "B4:AJ10",
"B4:AJ15", "B4:AJ16",
"B4:AJ15",
"B4:AJ15", "B4:AJ15",
"B4:AJ15", "B4:AJ15", "B4:AJ15", "B4:AJ15", "B4:AJ15", "B4:AJ15", "B4:AJ13", "B4:AJ12"
"B4:AK13", "B4:AK15", "B4:AK15", "B4:AK15", "B4:AK10",
"B4:AK15", "B4:AK16",
"B4:AK15",
"B4:AK15", "B4:AK15",
"B4:AK15", "B4:AK15", "B4:AK15", "B4:AK15", "B4:AK15", "B4:AK15", "B4:AK13", "B4:AK12"
)
)

data <- NULL

for (i in seq(1:nrow(sheets))) {
for (i in seq_len(nrow(sheets))) {
tmp <- suppressWarnings(
read_xlsx(
path = "awt_2022_d.xlsx", sheet = sheets[["sheet"]][[i]], col_names = TRUE,
col_types = c("text", "text", rep("numeric", 33)),
path = "awt_2023_d.xlsx", sheet = sheets[["sheet"]][[i]], col_names = TRUE,
col_types = c("text", "text", rep("numeric", 34)),
range = sheets[["range"]][[i]], .name_repair = "minimal", na = c("n/a")
)
) %>%
Expand Down Expand Up @@ -90,7 +91,7 @@ readAGEB <- function(subtype = "balances") {

data <- NULL

for (i in seq(1:nrow(sheets))) {
for (i in seq_len(nrow(sheets))) {
tmp <- read_xlsx(
path = "STRERZ_Abg_02_2024_korr.xlsx",
sheet = sheets[["sheet"]][[i]],
Expand All @@ -103,8 +104,8 @@ readAGEB <- function(subtype = "balances") {
mutate("TWh" = gsub("[0-9])", "", .data$TWh)) %>%
mutate("TWh" = trimws(.data$TWh))

tmp[12,"TWh"] <- "Erneuerbare, darunter Hausmüll"
tmp[16,"TWh"] <- "Sonstige, darunter Hausmüll"
tmp[12, "TWh"] <- "Erneuerbare, darunter Hausmuell"
tmp[16, "TWh"] <- "Sonstige, darunter Hausmuell"

tmp <- tmp %>%
mutate("variable" = paste0(sheets[["prefix"]][[i]], "|", .data$TWh)) %>%
Expand Down
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.197.3**
R package **mrremind**, version **0.197.4**

[![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, Koch J (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.197.3, <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 (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.197.4, <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 and Johannes Koch},
year = {2024},
note = {R package version 0.197.3},
note = {R package version 0.197.4},
url = {https://github.com/pik-piam/mrremind},
}
```
3 changes: 2 additions & 1 deletion man/readAGEB.Rd

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

0 comments on commit 3da87d3

Please sign in to comment.