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

cleanup FE prices in cs2 #451

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: '218987850'
ValidationKey: '219007455'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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.117.0
version: 1.117.1
date-released: '2023-09-05'
abstract: Contains the REMIND-specific routines for data and model output manipulation.
authors:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: remind2
Title: The REMIND R package (2nd generation)
Version: 1.117.0
Version: 1.117.1
Date: 2023-09-05
Authors@R: c(
person("Renato", "Rodrigues", , "[email protected]", role = c("aut", "cre")),
Expand Down
14 changes: 7 additions & 7 deletions R/readPopulation.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#' Read Population from GDX file
#'
#'
#' Read Population data from a GDX file into a magpie object.
#'
#'
#'
#'
#' @param gdx a GDX list as created by readGDX, or the file name of a gdx
#' file(file name is recommended as this speeds up the code)
#' @author Lavinia Baumstark
#' @examples
#'
#'
#' \dontrun{gdp <- readPopulation(gdx)}
#'
#'
#' @export
#' @importFrom gdx readGDX
#' @importFrom magclass getNames<-
readPopulation <- function(gdx){
pop <- readGDX(gdx, name=c('pm_pop','pm_datapop'), format="first_found") * 1000
readPopulation <- function(gdx) {
pop <- readGDX(gdx, name = c("pm_pop", "pm_datapop"), format = "first_found") * 1000
getNames(pop) <- "population [million]"
return(pop)
}
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.117.0**
R package **remind2**, version **1.117.1**

[![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.117.0, <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.117.1, <URL: 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.117.0},
note = {R package version 1.117.1},
url = {https://github.com/pik-piam/remind2},
}
```
137 changes: 18 additions & 119 deletions inst/markdown/compareScenarios2/cs2_02_macro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ items <- c(
"Internal|CES Function|Value|entrp",
"Internal|CES Function|Value|enb",
"Internal|CES Function|Value|ue_industry")

showAreaAndBarPlots(data, items, tot, scales = "fixed")
```

Expand All @@ -101,7 +101,7 @@ tot <- "Internal|CES Function|Value|enb"
items <- c(
"Internal|CES Function|Value|enhb",
"Internal|CES Function|Value|feelcb")

showAreaAndBarPlots(data, items, tot, scales = "fixed")
```

Expand All @@ -116,7 +116,7 @@ items <- c(
"Internal|CES Function|Value|ue_cement",
"Internal|CES Function|Value|ue_chemicals",
"Internal|CES Function|Value|ue_otherInd")

showAreaAndBarPlots(data, items, tot, scales = "fixed")
```

Expand Down Expand Up @@ -168,129 +168,28 @@ vars <-
walk(vars, showLinePlots, data = dPrice, scale = "fixed")
```

### FE Prices
### FE|Buildings Prices

```{r FE Prices}
vars <-
levels(dPrice$variable) %>%
str_subset("^Price\\|Final Energy\\|") %>%
str_subset(
"\\|Moving Avg|\\|Total LCOE|\\|Fuel Cost|\\|Transport and Distribution|\\|Carbon Price Component|\\|Other Taxes$",
negate = TRUE)

vars %>%
str_subset("Liquids") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
vars %>%
str_subset("Gases") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
vars %>%
str_subset("Solids") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
vars %>%
str_subset("Electricity") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
vars %>%
str_subset("Hydrogen") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
vars %>%
str_subset("Heat") %>%
walk(showLinePlots, data = dPrice, scale = "fixed")
```

### FE LCOE Prices Transport

```{r FE LCOE Prices Transport}

groups <- c(
"Price|Final Energy|Transport|Liquids|Petroleum",
"Price|Final Energy|Transport|Liquids|Diesel",
"Price|Final Energy|Transport|Liquids|Biomass",
"Price|Final Energy|Transport|Liquids|Efuel",
"Price|Final Energy|Transport|Gases|Natural Gas",
"Price|Final Energy|Transport|Gases|Efuel",
"Price|Final Energy|Transport|Electricity",
"Price|Final Energy|Transport|Hydrogen"
)

for (g in groups) {

items <- c(
paste0(g, "|Fuel Cost"),
paste0(g, "|Transport and Distribution"),
paste0(g, "|Carbon Price Component"),
paste0(g, "|Other Taxes")
)

tot <- paste0(g, "|Total LCOE")

showAreaAndBarPlots(dPrice, intersect(items, unique(dPrice$variable)), tot)
}
```{r FE Buildings Prices}
carriers <- c("Electricity", "Gases", "Heat", "Hydrogen", "Liquids", "Solids")
vars <- intersect(levels(dPrice$variable), paste0("Price|Final Energy|Buildings|", carriers))
walk(vars, showLinePlots, data = dPrice, scale = "fixed")
```

### FE LCOE Prices Buildings

```{r FE LCOE Prices Buildings}

groups <- c(
"Price|Final Energy|Buildings|Liquids|Oil",
"Price|Final Energy|Buildings|Liquids|Biomass",
"Price|Final Energy|Buildings|Liquids|Efuel",
"Price|Final Energy|Buildings|Gases|Natural Gas",
"Price|Final Energy|Buildings|Gases|Biomass",
"Price|Final Energy|Buildings|Gases|Efuel",
"Price|Final Energy|Buildings|Solids|Biomass",
"Price|Final Energy|Buildings|Electricity",
"Price|Final Energy|Buildings|Heat",
"Price|Final Energy|Buildings|Hydrogen"
)

for (g in groups) {

items <- c(
paste0(g, "|Fuel Cost"),
paste0(g, "|Transport and Distribution"),
paste0(g, "|Carbon Price Component"),
paste0(g, "|Other Taxes")
)
### FE|Industry Prices

tot <- paste0(g, "|Total LCOE")

showAreaAndBarPlots(dPrice, intersect(items, unique(dPrice$variable)), tot)
}
```{r FE Industry Prices}
carriers <- c("Electricity", "Gases", "Heat", "Hydrogen", "Liquids", "Solids")
vars <- intersect(levels(dPrice$variable), paste0("Price|Final Energy|Industry|", carriers))
walk(vars, showLinePlots, data = dPrice, scale = "fixed")
```

### FE LCOE Prices Industry

```{r FE LCOE Prices Industry}

groups <- c(
"Price|Final Energy|Industry|Liquids|Oil",
"Price|Final Energy|Industry|Liquids|Biomass",
"Price|Final Energy|Industry|Liquids|Efuel",
"Price|Final Energy|Industry|Gases|Natural Gas",
"Price|Final Energy|Industry|Gases|Biomass",
"Price|Final Energy|Industry|Gases|Efuel",
"Price|Final Energy|Industry|Solids|Coal",
"Price|Final Energy|Industry|Solids|Biomass",
"Price|Final Energy|Industry|Electricity",
"Price|Final Energy|Industry|Heat",
"Price|Final Energy|Industry|Hydrogen"
)
### FE|Transport Prices

for (g in groups) {

items <- c(
paste0(g, "|Fuel Cost"),
paste0(g, "|Transport and Distribution"),
paste0(g, "|Carbon Price Component"),
paste0(g, "|Other Taxes")
)

tot <- paste0(g, "|Total LCOE")

showAreaAndBarPlots(dPrice, intersect(items, unique(dPrice$variable)), tot)
}
```{r FE Transport Prices}
carriers <- c("Electricity", "Gases", "Heat", "Hydrogen", "Liquids", "Solids")
vars <- intersect(levels(dPrice$variable), paste0("Price|Final Energy|Transport|", carriers))
walk(vars, showLinePlots, data = dPrice, scale = "fixed")
```

## Trade
Expand Down