From 26352b3479c2379328e542e348e82b4126de56f2 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Tue, 12 Dec 2023 18:38:54 +0100 Subject: [PATCH] update output scripts --- scripts/output/single/dashboard.R | 43 ---------------------------- scripts/output/single/nashAnalysis.R | 22 ++++++++++++++ 2 files changed, 22 insertions(+), 43 deletions(-) delete mode 100644 scripts/output/single/dashboard.R create mode 100644 scripts/output/single/nashAnalysis.R diff --git a/scripts/output/single/dashboard.R b/scripts/output/single/dashboard.R deleted file mode 100644 index 082da851e..000000000 --- a/scripts/output/single/dashboard.R +++ /dev/null @@ -1,43 +0,0 @@ -# | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | REMIND License Exception, version 1.0 (see LICENSE file). -# | Contact: remind@pik-potsdam.de - -#' @title REMIND dashboard -#' @description Create REMIND dashboard results for single runs -#' -#' @author Renato Rodrigues -#' - -library(lucode2) -library(rmarkdown) -library(remind2) - -############################# BASIC CONFIGURATION ############################# - -if(!exists("source_include")) { - #Define arguments that can be read from command line - outputdir <- NULL # path to the output folder - readArgs("outputdir") -} - -scenario <- getScenNames(outputdir) -reportfile <- file.path(getwd(),outputdir,paste0("REMIND_generic_",scenario,".mif")) -gdx <- file.path(getwd(),outputdir,"fulldata.gdx") -statsFile <- file.path(getwd(),outputdir,"runstatistics.rda") -load(file = file.path(getwd(),outputdir,"config.Rdata")) -regionMapping <- cfg$regionmapping - -histFiles <- c(file.path(getwd(),outputdir, "/historical.mif"), file.path(getwd(),"./core/input/historical/historical.mif")) -for(hist in histFiles) { # Use first hist file that can be found - if(file.exists(hist)) break -} - -# path of the dashboard file -output_file <- file.path(getwd(),outputdir,paste0("REMIND_dashboard_",scenario,".html")) - -# generate dashboard for REMIND -dashboard(gdx=gdx, statsFile=statsFile, regionMapping=regionMapping, hist=hist, reportfile=reportfile, output_file=output_file) - diff --git a/scripts/output/single/nashAnalysis.R b/scripts/output/single/nashAnalysis.R new file mode 100644 index 000000000..af55ab1f8 --- /dev/null +++ b/scripts/output/single/nashAnalysis.R @@ -0,0 +1,22 @@ +# | (C) 2006-2023 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | REMIND License Exception, version 1.0 (see LICENSE file). +# | Contact: remind@pik-potsdam.de +library(lucode2) +library(remind2) + + +if(!exists("outputdir")) { + #Define arguments that can be read from command line + readArgs("outputdir") +} + +gdx_name <- "fulldata.gdx" +gdx <- file.path(outputdir, gdx_name) + +remind2::nashAnalysis( + gdx = gdx, + outputDir = outputdir +)