Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pik-piam/remind2 into convergence
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Dec 13, 2023
2 parents f62388d + 691d6e5 commit adcf008
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '221875483'
ValidationKey: '222064080'
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.126.1
date-released: '2023-12-12'
version: 1.127.0
date-released: '2023-12-13'
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.126.1
Date: 2023-12-12
Version: 1.127.0
Date: 2023-12-13
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.126.1**
R package **remind2**, version **1.127.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, Weigmann P (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.126.1, <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 (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.127.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 and Pascal Weigmann},
year = {2023},
note = {R package version 1.126.1},
note = {R package version 1.127.0},
url = {https://github.com/pik-piam/remind2},
}
```
28 changes: 15 additions & 13 deletions inst/markdown/compareScenarios2/cs2_02_macro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,25 @@ walk(vars, showLinePlots, data = data)

## FE intensity of GDP

```{r FE intensity of GDP}
```{r FE intensity of GDP_PPP}
items <- c(
"FE|Transport pGDP",
"FE|Buildings pGDP",
"FE|Industry pGDP")
"FE|Transport pGDP_PPP",
"FE|Buildings pGDP_PPP",
"FE|Industry pGDP_PPP")
showAreaAndBarPlots(data, items, scales = "fixed")
```

## FE intensity of GDP, linegraph (by GDP)
## FE intensity of GDP_PPP, linegraph (by pGDP_PPP)

```{r FE intensity of GDP, linegraph}
```{r FE intensity of GDP_PPP, linegraph}
dIea <-
data %>%
# To make the plots less crowded, show only IEA historical data.
filter(scenario != "historical" | model == "IEA")
items <- c(
"FE|Transport pGDP",
"FE|Buildings pGDP",
"FE|Industry pGDP")
"FE|Transport pGDP_PPP",
"FE|Buildings pGDP_PPP",
"FE|Industry pGDP_PPP")
showMultiLinePlots(dIea, items, scales = "fixed")
showMultiLinePlotsByVariable(dIea, items, "GDP|PPP pCap", scales = "fixed")
```
Expand All @@ -248,16 +248,18 @@ kaya <-
emiCO2_by_FE = `Emi|CO2|Energy` / FE,
FE_by_GDP_MER = FE / `GDP|MER`,
FE_by_GDP_PPP = FE / `GDP|PPP`,
GDP_by_Pop = `GDP|MER` / Population,
`Emi|CO2|Energy` = NULL, FE = NULL, `GDP|MER` = NULL) %>%
GDP_MER_by_Pop = `GDP|MER` / Population,
GDP_PPP_by_Pop = `GDP|PPP` / Population,
`Emi|CO2|Energy` = NULL, FE = NULL, `GDP|MER` = NULL, `GDP|PPP` = NULL) %>%
pivot_longer(
c(emiCO2_by_FE, FE_by_GDP_MER, FE_by_GDP_PPP, GDP_by_Pop, Population),
c(emiCO2_by_FE, FE_by_GDP_MER, FE_by_GDP_PPP, GDP_MER_by_Pop, GDP_PPP_by_Pop, Population),
names_to = "variable",
values_to = "value")
kayaUnits <- tribble(
~variable, ~unit,
"Population", "million",
"GDP_by_Pop", "billion US$2005/yr/million",
"GDP_MER_by_Pop", "billion US$2005/yr/million",
"GDP_PPP_by_Pop", "billion US$2005/yr/million",
"FE_by_GDP_MER", "EJ/billion US$2005",
"FE_by_GDP_PPP", "EJ/billion US$2005",
"emiCO2_by_FE", "EJ/Mt CO2")
Expand Down
10 changes: 5 additions & 5 deletions inst/markdown/compareScenarios2/cs2_main.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ data <-
```


```{r calculate pGDP variables}
```{r calculate pGDP_PPP variables}
dataGDP <-
data %>%
filter(variable == "GDP|PPP pCap") %>%
Expand All @@ -345,10 +345,10 @@ dataGDP <-
rename(gdp = value)
# For all variables in following table, add a new variable to data with the name
# "OldName pGDP". Calculate its value by
# "OldName pGDP_PPP". Calculate its value by
# OldValue / (GDP|PPP pCap) * conversionFactor
# and set its unit to newUnit.
# The new variable "OldName pGDP" will be available in the plot sections.
# The new variable "OldName pGDP_PPP" will be available in the plot sections.
pGdpVariables <- tribble(
~variable, ~newUnit, ~conversionFactor,
"FE", "MJ/US$2005", 1e3,
Expand All @@ -363,8 +363,8 @@ dataPGdp <-
left_join(dataGDP, c("scenario", "region", "period")) %>%
mutate(
value = value / gdp * conversionFactor,
variable = paste0(variable, " pGDP"),
varplus = paste0(varplus, " pGDP"),
variable = paste0(variable, " pGDP_PPP"),
varplus = paste0(varplus, " pGDP_PPP"),
unit = newUnit,
newUnit = NULL, conversionFactor = NULL, gdp = NULL)
Expand Down
24 changes: 17 additions & 7 deletions inst/markdown/nashAnalysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ htmltools::tagList(p)
### x: iter, slider: time, facet: enty
```{r results = "asis"}
p <- mip::mipIterations(
plotData = filter(p80_surplus, tall > 2005), # for this to work, we starting year must be available for all facets
plotData = filter(p80_surplus, tall >= 2025), # for this to work, we starting year must be available for all facets
xAxis = "iteration", slider = "tall", color = NULL, facets = "all_enty", facetScales = "free_y"
) %>% adjustSliderAnimation()
Expand Down Expand Up @@ -119,7 +119,7 @@ htmltools::tagList(p)
### x: iter, slider: time, facet: enty
```{r results = "asis"}
p <- mip::mipIterations(
filter(p80_pvp_itr, ttot > 2005), # for this to work, we starting year must be available for all facets
filter(p80_pvp_itr, ttot >= 2025), # for this to work, we starting year must be available for all facets
xAxis = "iteration", slider = "ttot", color = NULL, facets = "all_enty", facetScales = "free_y"
) %>% adjustSliderAnimation()
Expand Down Expand Up @@ -177,7 +177,7 @@ htmltools::tagList(p)
### x: iter, slider: time, facet: enty
```{r results = "asis"}
p <- mip::mipIterations(
filter(price_not_discounted_itr, ttot > 2005), # for this to work, we starting year must be available for all facets
filter(price_not_discounted_itr, ttot >= 2025), # for this to work, we starting year must be available for all facets
xAxis = "iteration", slider = "ttot", color = NULL, facets = "all_enty", facetScales = "free_y"
) %>% adjustSliderAnimation()
Expand Down Expand Up @@ -231,7 +231,8 @@ prices_and_surplus <- left_join(p80_surplus, price_not_discounted_itr,
prices_and_surplus_steps <- rbind(
prices_and_surplus,
.step(prices_and_surplus, 1),
.step(prices_and_surplus, 2)
.step(prices_and_surplus, 2),
.step(prices_and_surplus, 3)
) %>%
mutate(
"group" = ifelse(grepl("^p80_surplus", .data$variable), "p80_surplus", "p80_pvp_itr_no_discount"),
Expand All @@ -244,13 +245,22 @@ prices_and_surplus_steps <- rbind(

### x: time, slider: iter, facet: var
```{r results = "asis"}
for (v in unique(prices_and_surplus_steps$all_enty)) {
p <- mip::mipIterations(
plotData = filter(prices_and_surplus_steps, all_enty == v, tall >= 2005),
plotData = filter(prices_and_surplus_steps, all_enty == v, tall >= 2005), returnGgplots = TRUE,
xAxis = "tall", facets = "group", color = "step", slider = "iteration", facetScales = "free_y"
) %>% adjustSliderAnimation()
)
# manually override colors
plots <- p[[1]] +
ggplot2::scale_colour_manual(values = c("iter" = "#08519c", "iter+1" = "#3182bd",
"iter+2" = "#6baed6", "iter+3" = "#bdd7e7"))
plots <- list(plots)
plots <- lapply(plots, plotly::ggplotly) %>% adjustSliderAnimation()
print(htmltools::tagList(plots))
print(htmltools::tagList(p))
}
```

Expand Down

0 comments on commit adcf008

Please sign in to comment.