From d18ebe3999449e822a4c13ed3cf3cc51f7a3ac8a Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Fri, 22 Nov 2024 18:01:15 +0100 Subject: [PATCH 1/2] updates to scenario MIP validation --- inst/config/validationConfig_scenarioMIP.csv | 74 +++++---- .../markdown/validationReport_scenarioMIP.Rmd | 143 +++++++++++++----- 2 files changed, 137 insertions(+), 80 deletions(-) diff --git a/inst/config/validationConfig_scenarioMIP.csv b/inst/config/validationConfig_scenarioMIP.csv index 43508b9..674de19 100644 --- a/inst/config/validationConfig_scenarioMIP.csv +++ b/inst/config/validationConfig_scenarioMIP.csv @@ -1,44 +1,35 @@ metric;critical;variable;unit;model;scenario;region;period;min_red;min_yel;max_yel;max_red;ref_model;ref_scenario;ref_period;source/link to discussion Historical Vetting;;;;;;;;;;;;;;; -relative;yes;Final Energy;EJ/yr;;;;2010-2020;-20%;-10%;10%;20%;IEA;historical;; -relative;yes;Primary Energy|Coal;EJ/yr;;;;2010-2020;-20%;-10%;10%;20%;IEA;historical;; -relative;yes;Primary Energy|Oil;EJ/yr;;;;2010-2020;-20%;-10%;10%;20%;IEA;historical;; -relative;yes;Primary Energy|Gas;EJ/yr;;;;2010-2020;-20%;-10%;10%;20%;IEA;historical;; +relative;yes;Final Energy;EJ/yr;;;;2010-2020;-30%;-20%;20%;30%;IEA;historical;; +relative;yes;Final Energy;EJ/yr;;;World;2010-2020;-20%;-10%;10%;20%;IEA;historical;; +relative;yes;Primary Energy|Coal;EJ/yr;;;;2010-2020;-30%;-20%;20%;30%;IEA;historical;; +relative;yes;Primary Energy|Coal;EJ/yr;;;World;2010-2020;-20%;-10%;10%;20%;IEA;historical;; +relative;yes;Primary Energy|Oil;EJ/yr;;;;2010-2020;-30%;-20%;20%;30%;IEA;historical;; +relative;yes;Primary Energy|Oil;EJ/yr;;;World;2010-2020;-20%;-10%;10%;20%;IEA;historical;; +relative;yes;Primary Energy|Gas;EJ/yr;;;;2010-2020;-30%;-20%;20%;30%;IEA;historical;; +relative;yes;Primary Energy|Gas;EJ/yr;;;World;2010-2020;-20%;-10%;10%;20%;IEA;historical;; +relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;;;2010-2020;-30%;-20%;20%;30%;CEDS;historical;; +relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;;World;2010-2020;-20%;-10%;10%;20%;CEDS;historical;; Near-Term Trends;;;;;;;;;;;;;;; relative to 2030;;;;;;;;;;;;;;; -relative;yes;Emissions|CO2;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; -relative;yes;Emissions|CO2;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; -relative;yes;Emissions|CO2;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; -relative;yes;Emissions|CO2;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Supply;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Residential and Commercial;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Residential and Commercial;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Residential and Commercial;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Residential and Commercial;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Transportation;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Transportation;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Transportation;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; -relative;yes;Emissions|CO2|Energy|Demand|Transportation;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; -;;;;;;;;;;;;;;; +relative;yes;Emissions|CO2|Energy and Industrial Processes;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; +relative;yes;Emissions|CO2|Energy and Industrial Processes;Mt CO2/yr;;SSP2 - High Emissions, SSP2 - Low Emissions, SSP2 - Low Overshoot, SSP2 - Very Low Emissions, SSP2 - Medium Overshoot, SSP2 - Medium-Low Emissions, SSP2 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP2 - Medium Emissions;; +relative;yes;Emissions|CO2|Energy and Industrial Processes;Mt CO2/yr;;SSP3 - High Emissions;;2030;-20%;-10%;10%;20%;;SSP3 - Medium Emissions;; +relative;yes;Emissions|CO2|Energy and Industrial Processes;Mt CO2/yr;;SSP5 - High Emissions, SSP5 - Low Overshoot;;2030;-20%;-10%;10%;20%;;SSP5 - Medium Emissions;; +relative;yes;Emissions|CO2|Energy and Industrial Processes;Mt CO2/yr;;SSP1 - High Emissions, SSP1 - Very Low Emissions, SSP1 - Low Overshoot, SSP1 - Low Emissions, SSP1 - Low Emissions_a, SSP1 - Medium Emissions_a, SSP1 - Medium-Low Emissions, SSP1 - Very Low Emissions_a;;2030;-20%;-10%;10%;20%;;SSP1 - Medium Emissions;; +capacities and CCS from threshold.mif;;;;;;;;;;;;;;; CCS;;;;;;;;;;;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;World;2030;44.02;60.02;152.47;457.89;;;;Near-term vetting: Carbon Management -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Latin America (R10);2030;;6.36;28.84;;;;;https://github.com/pik-piam/mrremind/discussions/544 -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Rest of Asia (R10);2030;;0;20.91;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Africa (R10);2030;;0;2.24;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Europe (R10);2030;;1.12;110.6;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Middle East (R10);2030;;2.22;30.32;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Reforming Economies (R10);2030;;;0;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;Pacific OECD (R10);2030;;5.52;92.09;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;China+ (R10);2030;;2.01;12.95;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;India+ (R10);2030;;0;0.98;;;;; -absolute;yes;Carbon Capture|Storage;Mt CO2/yr;;;North America (R10);2030;;12.12;283.84;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;World;2030;44.02;60.02;152.47;457.89;;;;Near-term vetting: Carbon Management +absolute;yes;Carbon Capture;Mt CO2/yr;;;Latin America (R10);2030;;6.36;28.84;;;;;https://github.com/pik-piam/mrremind/discussions/544 +absolute;yes;Carbon Capture;Mt CO2/yr;;;Rest of Asia (R10);2030;;0.00;20.91;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;Africa (R10);2030;;0.00;2.24;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;Europe (R10);2030;;1.12;110.60;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;Middle East (R10);2030;;2.22;30.32;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;Reforming Economies (R10);2030;;;0.00;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;Pacific OECD (R10);2030;;5.52;92.09;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;China+ (R10);2030;;2.01;12.95;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;India+ (R10);2030;;0.00;0.98;;;;; +absolute;yes;Carbon Capture;Mt CO2/yr;;;North America (R10);2030;;12.12;283.84;;;;; Nuclear;;;;;;;;;;;;;;; absolute;yes;Capacity|Electricity|Nuclear;GW;;;World;2030;269.75;320.33;441.92;479.92;;;;Near-term vetting: Nuclear absolute;yes;Capacity|Electricity|Nuclear;GW;;;Latin America (R10);2030;;2.43;9.01;;;;;https://github.com/pik-piam/mrremind/discussions/540 @@ -52,8 +43,8 @@ absolute;yes;Capacity|Electricity|Nuclear;GW;;;China+ (R10);2030;;26.89;115.25;; absolute;yes;Capacity|Electricity|Nuclear;GW;;;India+ (R10);2030;;3.32;17.25;;;;; absolute;yes;Capacity|Electricity|Nuclear;GW;;;North America (R10);2030;;46.54;135.73;;;;; Hydro;;;;;;;;;;;;;;; -absolute;yes;Capacity|Electricity|Hydro;GW;;;World;2030;979.43;1175.37;1606.66;2117.58;;;;Near-term vetting: Hydro -absolute;yes;Capacity|Electricity|Hydro;GW;;;Latin America (R10);2030;;110.94;376.29;;;;;https://github.com/pik-piam/mrremind/discussions/541 +absolute;yes;Capacity|Electricity|Hydro;GW;;;World;2030;979.43;1175.37;1606.66;2117.58;;;;Near-term vetting: Hydro +absolute;yes;Capacity|Electricity|Hydro;GW;;;Latin America (R10);2030;;110.94;376.29;;;;;https://github.com/pik-piam/mrremind/discussions/541 absolute;yes;Capacity|Electricity|Hydro;GW;;;Rest of Asia (R10);2030;;32.88;189.6;;;;; absolute;yes;Capacity|Electricity|Hydro;GW;;;Africa (R10);2030;;15.3;96.39;;;;; absolute;yes;Capacity|Electricity|Hydro;GW;;;Europe (R10);2030;;106.16;436.09;;;;; @@ -63,3 +54,10 @@ absolute;yes;Capacity|Electricity|Hydro;GW;;;Pacific OECD (R10);2030;;65.94;259. absolute;yes;Capacity|Electricity|Hydro;GW;;;China+ (R10);2030;;201.24;832.12;;;;; absolute;yes;Capacity|Electricity|Hydro;GW;;;India+ (R10);2030;;27.06;149.56;;;;; absolute;yes;Capacity|Electricity|Hydro;GW;;;North America (R10);2030;;48.84;187.67;;;;; +;;;;;;;;;;;;;;; +post 2030;;;;;;;;;;;;;;; +absolute;yes;Capacity|Electricity|Nuclear;GW;;;World;2050;;;;991;;;;IAEA high case +absolute;yes;Carbon Capture;Mt CO2/yr;;;World;2035;;;;1300;;;;Kazlou et al. (https://www.nature.com/articles/s41558-024-02104-0) +absolute;yes;Carbon Capture;Mt CO2/yr;;;World;2040;;;;4300;;;;Kazlou et al. (https://www.nature.com/articles/s41558-024-02104-0) +absolute;yes;Carbon Capture;Mt CO2/yr;;;World;2050;;;;8600;;;;Grant et al. +absolute;yes;Primary Energy|Biomass;EJ/yr;;;World;2025-2100;;;100;300;;;;Creutzig et al. 2015: https://onlinelibrary.wiley.com/doi/10.1111/gcbb.12205 diff --git a/inst/markdown/validationReport_scenarioMIP.Rmd b/inst/markdown/validationReport_scenarioMIP.Rmd index 4205821..6b93893 100644 --- a/inst/markdown/validationReport_scenarioMIP.Rmd +++ b/inst/markdown/validationReport_scenarioMIP.Rmd @@ -37,7 +37,7 @@ knitr::opts_chunk$set( ## Import and Prepare Data Loading data from: -"scenarios_scenariomip_2024-11-19", "historical_R10_scenarioMIP_2024-11-05.mif" +"scenarios_scenariomip_2024-11-21", "historical_R10_scenarioMIP_2024-11-05.mif" ```{r} #for (m in params$mif) cat(paste0(normalizePath(m), "\n")) @@ -60,7 +60,10 @@ hist <- quitte::read.snapshot("/historical_R10_scenarioMIP_2024-11-05.mif") # %> #hist[, 2020, ] <- dimSums(hist, dim = 2)/5 #hist <- quitte::as.quitte(hist[, , ]) -data <- readRDS("/scenarios_scenariomip_2024-11-19.rds") + +#data <- quitte::read.snapshot("/scenarios_scenariomip_2024-11-21.csv") +#saveRDS(data, file = "scenarios_scenariomip_2024-11-21.rds") +data <- readRDS("/scenarios_scenariomip_2024-11-21.rds") dR10 <- filter(data, region %in% unique(hist$region)) @@ -88,25 +91,27 @@ colors <- c(green = "#008450", blue = "#4477aa", grey = "#808080") -ggplot(summary, aes(x = model, y= n, fill = check)) + +ggplot(summary, aes(x = model, y= n, fill = check)) + geom_bar(stat = "identity") + scale_fill_manual(values = colors) + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) ``` -## Lineplots Historical - Prototypes +## Lineplots Historical - Interactive Prototypes ### SSP1 ```{r, fig.width=10, fig.height=6} -i <- 1 -ssp <- paste0("SSP", i) +s <- 1 +ssp <- paste0("SSP", s) valiData <- filter(df, grepl(ssp, scenario), metric == "relative", ref_scenario == "historical") vars <- unique(valiData$variable) -for (var in vars) { +plot_list <- htmltools::tagList() +for (i in 1:length(vars)) { + var <- as.character(vars[i]) # this plots only the periods which are being validated # (change in validationConfig) p <- linePlotThresholds(valiData, var, reg = "World") @@ -128,21 +133,24 @@ for (var in vars) { geom_line(data = d, aes(x = period, y = value, color = model, linetype = scenario)) + ylab(var) - print(p) + plot_list[[i]] <- plotly::ggplotly(p) } +plot_list ``` ### SSP2 ```{r, fig.width=10, fig.height=6} -i <- 2 -ssp <- paste0("SSP", i) +s <- 2 +ssp <- paste0("SSP", s) valiData <- filter(df, grepl(ssp, scenario), metric == "relative", ref_scenario == "historical") vars <- unique(valiData$variable) -for (var in vars) { +plot_list <- htmltools::tagList() +for (i in 1:length(vars)) { + var <- as.character(vars[i]) # this plots only the periods which are being validated # (change in validationConfig) p <- linePlotThresholds(valiData, var, reg = "World") @@ -164,20 +172,23 @@ for (var in vars) { geom_line(data = d, aes(x = period, y = value, color = model, linetype = scenario)) + ylab(var) - print(p) + plot_list[[i]] <- plotly::ggplotly(p) } +plot_list ``` ### SSP3 ```{r, fig.width=10, fig.height=6} -i <- 3 -ssp <- paste0("SSP", i) +s <- 3 +ssp <- paste0("SSP", s) valiData <- filter(df, grepl(ssp, scenario), metric == "relative", ref_scenario == "historical") vars <- unique(valiData$variable) -for (var in vars) { +plot_list <- htmltools::tagList() +for (i in 1:length(vars)) { + var <- as.character(vars[i]) # this plots only the periods which are being validated # (change in validationConfig) p <- linePlotThresholds(valiData, var, reg = "World") @@ -199,20 +210,23 @@ for (var in vars) { geom_line(data = d, aes(x = period, y = value, color = model, linetype = scenario)) + ylab(var) - print(p) + plot_list[[i]] <- plotly::ggplotly(p) } +plot_list ``` ### SSP4 ```{r, fig.width=10, fig.height=6} -i <- 4 -ssp <- paste0("SSP", i) +s <- 4 +ssp <- paste0("SSP", s) valiData <- filter(df, grepl(ssp, scenario), metric == "relative", ref_scenario == "historical") vars <- unique(valiData$variable) -for (var in vars) { +plot_list <- htmltools::tagList() +for (i in 1:length(vars)) { + var <- as.character(vars[i]) # this plots only the periods which are being validated # (change in validationConfig) p <- linePlotThresholds(valiData, var, reg = "World") @@ -234,21 +248,24 @@ for (var in vars) { geom_line(data = d, aes(x = period, y = value, color = model, linetype = scenario)) + ylab(var) - print(p) + plot_list[[i]] <- plotly::ggplotly(p) } +plot_list ``` ### SSP5 ```{r, fig.width=10, fig.height=6} -i <- 5 -ssp <- paste0("SSP", i) +s <- 5 +ssp <- paste0("SSP", s) valiData <- filter(df, grepl(ssp, scenario), metric == "relative", ref_scenario == "historical") vars <- unique(valiData$variable) -for (var in vars) { +plot_list <- htmltools::tagList() +for (i in 1:length(vars)) { + var <- as.character(vars[i]) # this plots only the periods which are being validated # (change in validationConfig) p <- linePlotThresholds(valiData, var, reg = "World") @@ -270,19 +287,24 @@ for (var in vars) { geom_line(data = d, aes(x = period, y = value, color = model, linetype = scenario)) + ylab(var) - print(p) + plot_list[[i]] <- plotly::ggplotly(p) } +plot_list ``` ## Historical (non-interactive) +```{r, fig.width=10, fig.height=10} +# all following heat maps should not show historic periods in this document +df <- filter(df, period >= 2020) +``` + ### All models, all scenarios -Deviation to IEA data +Deviation to IEA data (no 2020 smoothing) ```{r, fig.width=10, fig.height=10} -df <- filter(df, period >= 2020) d <- filter(df, metric == "relative", ref_scenario == "historical" | is.na(ref_scenario)) interact <- FALSE @@ -337,11 +359,7 @@ if (nrow(d) > 0) { plot_list <- htmltools::tagList() for (i in 1:length(models)) { d_model <- filter(d, model == models[i]) - plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", - x_plot = "region", - y_plot = "period", - x_facet = "variable", - y_facet = "scenario", + plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", interactive = interact) %>% # avoid overlap of title and facet labels (plotly issue) plotly::layout(title = list(y = .95, xref = "plot"), @@ -368,11 +386,7 @@ if (nrow(d) > 0) { plot_list <- htmltools::tagList() for (i in 1:length(models)) { d_model <- filter(d, model == models[i]) - plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", - x_plot = "region", - y_plot = "period", - x_facet = "variable", - y_facet = "scenario", + plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", interactive = interact) %>% # avoid overlap of title and facet labels (plotly issue) layout(title = list(y = .95, xref = "plot"), @@ -391,7 +405,56 @@ https://github.com/pik-piam/mrremind/discussions/540 https://github.com/pik-piam/mrremind/discussions/541 ```{r, fig.width=10, fig.height=10} -d <- filter(df, metric == "absolute") +d <- filter(df, metric == "absolute", grepl("Capacity", variable)) +interact <- TRUE + +# interactive plots can only be printed from outside of loops, use tagList +# to store html objects in List +if (nrow(d) > 0) { + models <- unique(d$model) + plot_list <- htmltools::tagList() + for (i in 1:length(models)) { + d_model <- filter(d, model == models[i]) + plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", + interactive = interact) %>% + # avoid overlap of title and facet labels (plotly issue) + layout(title = list(y = .95, xref = "plot"), + margin = list(l = 0, t = 150, r = 150)) + } + plot_list +} +``` + +### Biomass by Model + +```{r, fig.width=10, fig.height=10} +d <- filter(df, metric == "absolute", + variable %in% c("Primary Energy|Biomass")) +interact <- TRUE + +# interactive plots can only be printed from outside of loops, use tagList +# to store html objects in List +if (nrow(d) > 0) { + models <- unique(d$model) + plot_list <- htmltools::tagList() + for (i in 1:length(models)) { + d_model <- filter(d, model == models[i]) + plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", + interactive = interact) %>% + # avoid overlap of title and facet labels (plotly issue) + layout(title = list(y = .95, xref = "plot"), + margin = list(l = 0, t = 150, r = 150)) + } + plot_list +} +``` + +### Carbon Capture by Model + +```{r, fig.width=10, fig.height=10} + +d <- filter(df, metric == "absolute", + variable %in% c("Carbon Capture")) interact <- TRUE # interactive plots can only be printed from outside of loops, use tagList @@ -401,11 +464,7 @@ if (nrow(d) > 0) { plot_list <- htmltools::tagList() for (i in 1:length(models)) { d_model <- filter(d, model == models[i]) - plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", - x_plot = "region", - y_plot = "period", - x_facet = "variable", - y_facet = "scenario", + plot_list[[i]] <- validationHeatmap(d_model, main_dim = "model", interactive = interact) %>% # avoid overlap of title and facet labels (plotly issue) layout(title = list(y = .95, xref = "plot"), From e674b1da3edc750b9c1cb44f72f40049e6d057e1 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Fri, 22 Nov 2024 18:06:31 +0100 Subject: [PATCH 2/2] increment version --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index d1cc0e4..0b8a1e5 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '821968' +ValidationKey: '842058' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index ca92c64..9431364 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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: 'piamValidation: Validation Tools for PIK-PIAM' -version: 0.4.1 -date-released: '2024-11-21' +version: 0.4.2 +date-released: '2024-11-22' abstract: The piamValidation package provides validation tools for the Potsdam Integrated Assessment Modelling environment. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 70237c6..2788ed6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: piamValidation Title: Validation Tools for PIK-PIAM -Version: 0.4.1 -Date: 2024-11-21 +Version: 0.4.2 +Date: 2024-11-22 Authors@R: c(person("Pascal", "Weigmann",, "pascal.weigmann@pik-potsdam.de", role = c("aut", "cre")), person("Oliver", "Richters",, role = "aut")) diff --git a/README.md b/README.md index f9f6087..8630fec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Validation Tools for PIK-PIAM -R package **piamValidation**, version **0.4.1** +R package **piamValidation**, version **0.4.2** [![CRAN status](https://www.r-pkg.org/badges/version/piamValidation)](https://cran.r-project.org/package=piamValidation) [![R build status](https://github.com/pik-piam/piamValidation/workflows/check/badge.svg)](https://github.com/pik-piam/piamValidation/actions) [![codecov](https://codecov.io/gh/pik-piam/piamValidation/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piamValidation) [![r-universe](https://pik-piam.r-universe.dev/badges/piamValidation)](https://pik-piam.r-universe.dev/builds) @@ -46,7 +46,7 @@ In case of questions / problems please contact Pascal Weigmann . +Weigmann P, Richters O (2024). _piamValidation: Validation Tools for PIK-PIAM_. R package version 0.4.2, . A BibTeX entry for LaTeX users is @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is title = {piamValidation: Validation Tools for PIK-PIAM}, author = {Pascal Weigmann and Oliver Richters}, year = {2024}, - note = {R package version 0.4.1}, + note = {R package version 0.4.2}, url = {https://github.com/pik-piam/piamValidation}, } ```