-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from mellamoSimon/add-incineration-trajectories
Add trajectories for incineration rates for plastic waste
- Loading branch information
Showing
10 changed files
with
396 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.171.2 | ||
Date: 2023-11-13 | ||
Version: 0.172.0 | ||
Date: 2023-11-23 | ||
Authors@R: c( | ||
person("Lavinia", "Baumstark", , "[email protected]", role = c("aut", "cre")), | ||
person("Renato", "Rodrigues", role = "aut"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#' calculates projections for the end of life fate of plastic waste | ||
#' in particular, calculates the share that is incinerated | ||
#' | ||
#' @md | ||
#' @return A list with a [`magpie`][magclass::magclass] object `x`, `weight`, | ||
#' `unit`, `description`. | ||
#' | ||
#' @author Falk Benke, Simón Moreno Leiva | ||
#' | ||
#' @seealso [`calcOutput()`] | ||
#' | ||
#' @importFrom dplyr filter pull select | ||
#' @importFrom madrat getISOlist toolFillYears | ||
#' @importFrom magclass new.magpie getItems | ||
#' @importFrom rlang .data | ||
#' @importFrom tibble as_tibble | ||
#' @importFrom quitte calc_addVariable | ||
#' | ||
#' @export | ||
#' | ||
calcPlasticsEoL <- function() { | ||
# read source data ---- | ||
|
||
# read in projections for plastics end-of-life flows EJ/yr | ||
x <- readSource("Stegmann2022") | ||
|
||
# select variables that we are going to need to calculate incineration shares | ||
selection <- c( | ||
"Plastics|Waste|Buildings & Construction", | ||
"Plastics|Waste|Consumer Products", | ||
"Plastics|Waste|Electrical & Electronic (products)", | ||
"Plastics|Waste|Industrial Machinery", | ||
"Plastics|Waste|Other", | ||
"Plastics|Waste|Packaging", | ||
"Plastics|Waste|Textiles", | ||
"Plastics|Waste|Transportation", | ||
"Plastics|End of Life|Waste to Energy" | ||
) | ||
|
||
x <- x[, , selection, pmatch = TRUE] | ||
|
||
y <- as.quitte(x) | ||
# calculate total plastic waste | ||
plasticsEoL <- y %>% | ||
# we could have switches to include a circular scenario but it would probably | ||
# require a different scenario to calibrate | ||
filter(!!sym("scenario") %in% c("SSP2")) %>% | ||
calc_addVariable( | ||
"Plastics|Waste|Total" = " | ||
`Plastics|Waste|Buildings & Construction` + | ||
`Plastics|Waste|Consumer Products` + | ||
`Plastics|Waste|Electrical & Electronic (products)` + | ||
`Plastics|Waste|Industrial Machinery`+ | ||
`Plastics|Waste|Other`+ | ||
`Plastics|Waste|Packaging`+ | ||
`Plastics|Waste|Textiles`+ | ||
`Plastics|Waste|Transportation` | ||
", | ||
units = "PJ/yr" | ||
) | ||
|
||
# calculate share (0 to 1) of waste that gets incinerated | ||
incinerationShares <- plasticsEoL %>% | ||
calc_addVariable( | ||
"Plastics|End of Life|Incineration share" = " | ||
`Plastics|End of Life|Waste to Energy`/ | ||
`Plastics|Waste|Total` | ||
", | ||
units = "fraction", only.new = TRUE | ||
) %>% | ||
# remove unused dimensions | ||
select(-"model", -"scenario", -"variable", -"unit") %>% | ||
interpolate_missing_periods(seq(2050, 2060, 5), method = "linear") | ||
|
||
# as magpie | ||
x <- as.magpie(incinerationShares) | ||
|
||
# fill post 2100 years | ||
# post 2100 = 2100 | ||
xNew <- new.magpie( | ||
cells_and_regions = getItems(x, dim = 1), | ||
years = c(seq(2110, 2150, 20)), | ||
names = getNames(x) | ||
) | ||
|
||
xNew[, c(seq(2110, 2150, 20)), ] <- x[, 2100, ] | ||
|
||
x <- mbind(x, xNew) %>% | ||
toolCountryFill(fill = 0) %>% | ||
collapseDim() | ||
|
||
|
||
# create weights ---- | ||
|
||
fe <- calcOutput("FE", source = "IEA", aggregate = FALSE)[, 2016, "FE (EJ/yr)"] | ||
|
||
return( | ||
list( | ||
x = x, | ||
weight = fe, | ||
unit = "fraction", | ||
description = "share of plastic waste that gets incinerated" | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' @title convertStegmann2022 | ||
#' @description Converts data from Stegmann2022 | ||
#' @param x unconverted magpie object from read-script | ||
#' | ||
#' @return magpie object with a completed dataset. | ||
#' | ||
|
||
convertStegmann2022 <- function(x) { | ||
x <- x[c("World"), , , invert = TRUE] | ||
|
||
regmapping <- toolGetMapping("regionmapping_IMAGE_PBL_Stegmann2022.csv", where = "mrremind", type = "regional") | ||
|
||
fe <- calcOutput("FE", source = "IEA", aggregate = FALSE)[unique(regmapping$CountryCode), 2016, "FE (EJ/yr)"] | ||
|
||
out <- toolAggregate(x, regmapping, from = "RegionAbbreviation", to = "CountryCode", weight = fe) | ||
out <- toolCountryFill(out, fill = 0) | ||
|
||
return(out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' Read PlasticsEoL | ||
#' | ||
#' Read-in data for the End-of-Life fate of plastics | ||
#' from 1.Stegmann, P., Daioglou, V., Londo, M., van Vuuren, | ||
#' D. P. & Junginger, M. Plastic futures and their CO2 emissions. | ||
#' Nature 612, 272–276 (2022). | ||
#' https://www.nature.com/articles/s41586-022-05422-5 | ||
#' Link to SI: | ||
#' https://static-content.springer.com/esm/art%3A10.1038%2Fs41586-022-05422-5/MediaObjects/41586_2022_5422_MOESM1_ESM.xlsx #nolint | ||
#' | ||
#' @md | ||
#' @return magpie object of the data | ||
#' @author Falk Benke, Simón Moreno | ||
#' @seealso \code{\link{readSource}} | ||
#' @examples | ||
#' \dontrun{ | ||
#' a <- readSource(type = "Stegmann2022") | ||
#' } | ||
#' | ||
#' @importFrom readxl read_xlsx | ||
#' @importFrom reshape2 melt | ||
|
||
readStegmann2022 <- function() { | ||
|
||
data <- read_xlsx("41586_2022_5422_MOESM1_ESM.xlsx", sheet = "Data") | ||
|
||
reshape2::melt(data, id.vars = seq(1, 5), variable.name = "period") %>% | ||
as.magpie(spatial = 3) %>% | ||
return() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.