diff --git a/CHANGELOG.md b/CHANGELOG.md index 95b009e095..41ce60ac3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **script** scripts/start_functions.R decide individually for demand and price whether they are read from a REMIND report. - **80_optimization** abort GAMS in case of execution errors - **script** updated EATLancet project start scripts +- **script** replaced gdx package with gdx2 package calls ### added - **scripts** added output report `EU_report.R` that uses `EU_report.Rmd` diff --git a/scripts/calibration/calc_calib.R b/scripts/calibration/calc_calib.R index 76ec96c28b..5fb4af9246 100644 --- a/scripts/calibration/calc_calib.R +++ b/scripts/calibration/calc_calib.R @@ -39,7 +39,7 @@ calibration_run <- function(putfolder, calib_magpie_name, logoption = 3) { get_areacalib <- function(gdx_file) { require(magclass) require(magpie4) - require(gdx) + require(gdx2) data <- readGDX(gdx_file, "pm_land_start")[, , c("crop", "past")] data <- dimSums(data, dim = 1.2) magpie <- land(gdx_file)[, , c("crop", "past")] @@ -54,7 +54,7 @@ get_areacalib <- function(gdx_file) { get_yieldcalib <- function(gdx_file) { require(magclass) - require(gdx) + require(gdx2) require(luscale) prep <- function(x) { @@ -81,6 +81,7 @@ update_calib <- function(gdx_file, calib_accuracy = 0.1, calibrate_pasture = TRU n_maxcalib = 20, best_calib = FALSE) { require(magclass) require(magpie4) + require(gdx2) if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible") area_factor <- get_areacalib(gdx_file) diff --git a/scripts/calibration/landconversion_cost.R b/scripts/calibration/landconversion_cost.R index 138e047690..306c4bca6e 100644 --- a/scripts/calibration/landconversion_cost.R +++ b/scripts/calibration/landconversion_cost.R @@ -38,7 +38,7 @@ calibration_run <- function(putfolder, calib_magpie_name, logoption = 3, s_use_g getCalibFactor <- function(gdx_file, mode = "cost", calib_accuracy = 0.05, lowpass_filter = 1) { require(magclass) require(magpie4) - require(gdx) + require(gdx2) y <- readGDX(gdx_file,"t") magpie <- land(gdx_file)[, y, "crop"] hist <- dimSums(readGDX(gdx_file, "f10_land")[, , "crop"], dim = 1.2) @@ -94,6 +94,7 @@ getHistCrop <- function() { update_calib <- function(gdx_file, calib_accuracy = 0.05, lowpass_filter = 1, calib_file, cost_max = 3, cost_min = 0.05, calibration_step = "", n_maxcalib = 40, best_calib = FALSE) { require(magclass) require(magpie4) + require(gdx2) if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible") y <- readGDX(gdx_file,"t") diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index 9194cc03bf..2592a29f12 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -16,6 +16,7 @@ library(luscale) library(madrat) library(dplyr) library(gms) +library(gdx2) # ============================================= # Basic configuration diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index bde43b4419..ae270348a8 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -13,7 +13,7 @@ # Author: Florian Humpenoeder library(magclass) -library(gdx) +library(gdx2) library(magpie4) library(lucode2) library(gms) diff --git a/scripts/output/extra/out_of_bounds_check.R b/scripts/output/extra/out_of_bounds_check.R index b5489eac17..602ca5f8fc 100644 --- a/scripts/output/extra/out_of_bounds_check.R +++ b/scripts/output/extra/out_of_bounds_check.R @@ -15,7 +15,7 @@ ######################### # Version 1.0, Florian Humpenoeder # -library(gdx) +library(gdx2) library(lucode2) library(magclass) diff --git a/scripts/output/extra/reportMAgPIE2SEALS.R b/scripts/output/extra/reportMAgPIE2SEALS.R index 8b325e86c1..936cb02911 100644 --- a/scripts/output/extra/reportMAgPIE2SEALS.R +++ b/scripts/output/extra/reportMAgPIE2SEALS.R @@ -14,7 +14,7 @@ # 1.00: first working version library(gms) -library(gdx) +library(gdx2) library(magpie4) message("Starting to report gridded MAgPIE land use for SEALS") diff --git a/scripts/output/projects/FSDP_collect.R b/scripts/output/projects/FSDP_collect.R index 120eacc858..daf8578cc7 100644 --- a/scripts/output/projects/FSDP_collect.R +++ b/scripts/output/projects/FSDP_collect.R @@ -17,7 +17,7 @@ library(magclass) library(gms) library(magpiesets) library(data.table) -library(gdx) +library(gdx2) library(quitte) library(m4fsdp) library(stringr) diff --git a/scripts/output/projects/FSDP_collect2.R b/scripts/output/projects/FSDP_collect2.R index 6b842a2880..8e20f3c97a 100644 --- a/scripts/output/projects/FSDP_collect2.R +++ b/scripts/output/projects/FSDP_collect2.R @@ -17,7 +17,7 @@ library(magclass) library(gms) library(magpiesets) library(data.table) -library(gdx) +library(gdx2) library(quitte) library(m4fsdp) library(stringr) diff --git a/scripts/output/projects/peatland.R b/scripts/output/projects/peatland.R index 6cbf8d45e9..915a87ca78 100644 --- a/scripts/output/projects/peatland.R +++ b/scripts/output/projects/peatland.R @@ -18,7 +18,7 @@ library(lucode2) library(magpie4) library(luscale) - +library(gdx2) library(luplot) library(ggplot2) library(luscale) diff --git a/scripts/output/validation_cell.R b/scripts/output/validation_cell.R index 4113c4d201..d924c90247 100644 --- a/scripts/output/validation_cell.R +++ b/scripts/output/validation_cell.R @@ -15,6 +15,7 @@ library(luscale) library(luplot) library(lusweave) library(magpiesets) +library(gdx2) ############################# BASIC CONFIGURATION ############################## if (!file.exists(paste0(outputdir, "/LUH2_croparea_0.5.mz"))) stop("Cell validation is not possible. LUH2_croparea_0.5.mz and MAPSPAM_croparea_0.5.mz files are missing") diff --git a/scripts/run_submit/submit_priority.sh b/scripts/run_submit/submit_priority.sh index a1d82d0ce6..33c8496d5e 100644 --- a/scripts/run_submit/submit_priority.sh +++ b/scripts/run_submit/submit_priority.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=priority -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/run_submit/submit_priority_maxMem.sh b/scripts/run_submit/submit_priority_maxMem.sh index 612b33efc5..ae58b9695f 100644 --- a/scripts/run_submit/submit_priority_maxMem.sh +++ b/scripts/run_submit/submit_priority_maxMem.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=priority -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/run_submit/submit_standby.sh b/scripts/run_submit/submit_standby.sh index 8dca74aae4..f0bff32339 100644 --- a/scripts/run_submit/submit_standby.sh +++ b/scripts/run_submit/submit_standby.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=standby -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/run_submit/submit_standby_dayMax.sh b/scripts/run_submit/submit_standby_dayMax.sh index 39b04f8baa..d7836390d1 100644 --- a/scripts/run_submit/submit_standby_dayMax.sh +++ b/scripts/run_submit/submit_standby_dayMax.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=standby -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/run_submit/submit_standby_maxMem.sh b/scripts/run_submit/submit_standby_maxMem.sh index e556d4aff3..23b0999431 100644 --- a/scripts/run_submit/submit_standby_maxMem.sh +++ b/scripts/run_submit/submit_standby_maxMem.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=standby -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/run_submit/submit_standby_maxMem_dayMax.sh b/scripts/run_submit/submit_standby_maxMem_dayMax.sh index 9e02db436d..ac3ba4d307 100644 --- a/scripts/run_submit/submit_standby_maxMem_dayMax.sh +++ b/scripts/run_submit/submit_standby_maxMem_dayMax.sh @@ -1,7 +1,6 @@ #!/bin/bash #SBATCH --qos=standby -#SBATCH --partition=priority #SBATCH --job-name=mag-run #SBATCH --output=slurm.log #SBATCH --mail-type=END,FAIL diff --git a/scripts/slurmOutput.yml b/scripts/slurmOutput.yml index da4bfc3254..f493010be1 100644 --- a/scripts/slurmOutput.yml +++ b/scripts/slurmOutput.yml @@ -1,5 +1,5 @@ slurmjobs: - SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --time=24:00:00" - SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" - SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority" - SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority --mem-per-cpu=0 --cpus-per-task=16" + SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" + SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" + SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END,FAIL --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" diff --git a/scripts/slurmStart.yml b/scripts/slurmStart.yml index f3e52215ed..8040e4a28c 100644 --- a/scripts/slurmStart.yml +++ b/scripts/slurmStart.yml @@ -1,4 +1,4 @@ slurmjobs: - SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=priority --partition=priority --cpus-per-task=3" - SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=standby --partition=priority --cpus-per-task=3" + SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=priority --cpus-per-task=3" + SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=standby --cpus-per-task=3" SLURM medium: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END,FAIL --wrap=\"Rscript %SCRIPT\" --qos=medium --cpus-per-task=3" diff --git a/scripts/start/extra/input_REMIND.R b/scripts/start/extra/input_REMIND.R index ed991a19c3..914ad26d0c 100644 --- a/scripts/start/extra/input_REMIND.R +++ b/scripts/start/extra/input_REMIND.R @@ -12,7 +12,7 @@ library(gms) library(magclass) -library(gdx) +library(gdx2) # Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") diff --git a/scripts/start/projects/paper_peatland.R b/scripts/start/projects/paper_peatland.R index a520a9e6ff..c46c579ed6 100644 --- a/scripts/start/projects/paper_peatland.R +++ b/scripts/start/projects/paper_peatland.R @@ -12,7 +12,7 @@ library(gms) library(magclass) -library(gdx) +library(gdx2) library(luscale) library(magpie4) diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R index b21af3cdf6..4295fba570 100644 --- a/scripts/start/projects/project_ABCDR.R +++ b/scripts/start/projects/project_ABCDR.R @@ -7,7 +7,7 @@ library(lucode2) library(gms) library(magclass) -library(gdx) +library(gdx2) # Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") diff --git a/scripts/start/projects/project_BEST.R b/scripts/start/projects/project_BEST.R index 689d357b59..c525421d52 100644 --- a/scripts/start/projects/project_BEST.R +++ b/scripts/start/projects/project_BEST.R @@ -17,7 +17,7 @@ version <- "V13" library(lucode2) library(magclass) -library(gdx) +library(gdx2) library(magpie4) library(gms) diff --git a/scripts/start/projects/project_LAMACLIMA_WP4.R b/scripts/start/projects/project_LAMACLIMA_WP4.R index a3b87fdc5f..53abde91de 100644 --- a/scripts/start/projects/project_LAMACLIMA_WP4.R +++ b/scripts/start/projects/project_LAMACLIMA_WP4.R @@ -16,7 +16,7 @@ library(gms) library(magclass) -library(gdx) +library(gdx2) # Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R")