From 141cc01ef32dc4a6ba8fe42ba6405a3d4c209fa8 Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Thu, 8 Aug 2024 09:09:29 +0200 Subject: [PATCH] use downscaleRunESM --- DESCRIPTION | 1 + .../output/extra/disaggregation_mrdownscale.R | 17 +---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ab960bac8..c6007c09d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,6 +41,7 @@ Imports: Suggests: goxygen, languageserver, + mrdownscale (>= 0.23.0), qgraph, shinyresults, XML diff --git a/scripts/output/extra/disaggregation_mrdownscale.R b/scripts/output/extra/disaggregation_mrdownscale.R index 6217ab2f0..72f0e065f 100644 --- a/scripts/output/extra/disaggregation_mrdownscale.R +++ b/scripts/output/extra/disaggregation_mrdownscale.R @@ -9,19 +9,4 @@ # description: Downscale MAgPIE results to 0.25 degree resolution in LUH2 format for ESMs # comparison script: FALSE # ------------------------------------------------------------------------------------------------ -library(mrdownscale) - -outputdir <- normalizePath(outputdir) - -clustermap <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) -gdx <- file.path(outputdir, "fulldata.gdx") -stopifnot(file.exists(gdx), length(clustermap) == 1) - -scenario <- gsub("_", "-", sub("-mag-[0-9]+$", "", basename(outputdir))) - -local({ # redirectSource is local by default, running it in the global environment does not work - redirectSource("MagpieFulldataGdx", c(clustermap, gdx), linkOthers = FALSE) - stopifnot(length(getConfig("redirections")) >= 1) - retrieveData("ESM", rev = format(Sys.time(), "%Y-%m-%d"), scenario = scenario, progress = FALSE, - outputfolder = outputdir) -}) +mrdownscale::downscaleRunESM(outputdir)