Skip to content

Commit

Permalink
Merge pull request #375 from 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q/dev/sep…
Browse files Browse the repository at this point in the history
…arate_historic_steel_shares

consolidate historic and scenario steel production mix; add lineplot of production shares
  • Loading branch information
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q authored Aug 22, 2023
2 parents a173ba5 + 9c387f1 commit a30d2a6
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '218283264'
ValidationKey: '218439650'
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.114.6
date-released: '2023-08-15'
version: 1.115.0
date-released: '2023-08-22'
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.114.6
Date: 2023-08-15
Version: 1.115.0
Date: 2023-08-22
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
person("Lavinia", "Baumstark", role = "aut"),
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.114.6**
R package **remind2**, version **1.115.0**

[![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, 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.114.6, <URL: 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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.115.0, <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 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},
year = {2023},
note = {R package version 1.114.6},
note = {R package version 1.115.0},
url = {https://github.com/pik-piam/remind2},
}
```
58 changes: 51 additions & 7 deletions inst/markdown/compareScenarios2/cs2_06_energy_services.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -240,31 +240,50 @@ items <- c("Production|Industry|Steel|Primary",
dPlot <- data %>%
filter(variable %in% items) %>%
mutate(foo = shorten_legend(variable)) %>%
order.levels(foo = rev(shorten_legend(items)))
mutate(variable = shorten_legend(variable)) %>%
order.levels(variable = rev(shorten_legend(items)),
scenario = unique(c('historical', levels(data$scenario))))
# Show at max 5 scenario rows by 7 region column plots
for (regions in bin_distribute(getRegs(dPlot), 7)) {
for (scenarios in bin_distribute(getScenarios(dPlot), 5)) {
suppressWarnings(
for (scenarios in bin_distribute(setdiff(getScenarios(dPlot), 'historical'),
5)) {
suppressWarnings(
p <- ggplot_bar_remind_vts(
data = dPlot %>%
filter(scenario %in% scenarios,
region %in% regions),
mapping = aes(x = period, y = value, fill = foo),
mapping = aes(x = period, y = value, fill = variable),
gaps = 0) +
scale_fill_discrete(breaks = shorten_legend(items),
name = attr(shorten_legend(items), "front")) +
# fix y-axis across regions (columns)
geom_blank(
data = dPlot %>%
filter(scenario %in% scenarios,
region %in% regions) %>%
filter(scenario %in% scenarios,
region %in% regions) %>%
group_by(region, period, scenario) %>%
summarise(value = sum(value), .groups = "drop_last") %>%
mutate(value = max(value)) %>%
add_remind_timesteps_columns(),
mapping = aes(x = xpos, y = value)) +
geom_step(data = dPlot %>%
filter(region %in% regions,
'historical' == scenario) %>%
complete(nesting(model, region, variable, unit, period,
value),
scenario = scenarios) %>%
filter('historical' != scenario) %>%
group_by(model, scenario, region, unit, period) %>%
arrange(model, scenario, region, unit, period,
desc(variable)) %>%
mutate(value = cumsum(value)) %>%
ungroup(),
mapping = aes(x = period, y = value, colour = 'historic',
group = interaction(region, variable)),
direction = 'vh') +
scale_colour_manual(values = c('historic' = 'black'),
name = NULL) +
facet_wrap(~ interaction(region, scenario, sep = " "),
nrow = length(scenarios), scales = "free_y") +
labs(x = NULL, y = dPlot %>% pull(unit) %>% unique()) +
Expand All @@ -275,6 +294,31 @@ for (regions in bin_distribute(getRegs(dPlot), 7)) {
cat("\n\n")
}
}
p <- ggplot() +
geom_line(data = dPlot %>%
filter(2100 >= period) %>%
group_by(scenario, region, period) %>%
mutate(value = value / sum(value),
variable = paste(variable, 'Share')) %>%
ungroup(),
mapping = aes(x = period, y = value, colour = scenario,
linetype = variable)) +
scale_colour_manual(
values = c(gg_colour_hue(setdiff(levels(dPlot$scenario), 'historical')),
c('historical' = 'black')),
name = NULL) +
scale_linetype_discrete(name = NULL,
guide = guide_legend(nrow = 2)) +
scale_y_continuous(breaks = seq(0, 1, 0.2),
minor_breaks = seq(0.1, 0.9, 0.2)) +
facet_wrap(~ region) +
labs(x = NULL, y = NULL) +
theme_minimal() +
theme(legend.position = 'bottom')
plot(p)
cat('\n\n')
```

### Subsector per-Capita Production
Expand Down

0 comments on commit a30d2a6

Please sign in to comment.