Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Kaya GDP_ppp/population #496

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '221844520'
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.0
date-released: '2023-12-11'
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.0
Date: 2023-12-11
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.0**
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.0, <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.0},
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