Skip to content

Commit f1c83b0

Browse files
committed
write results_folder and model_version to gdx
1 parent 72fb9d4 commit f1c83b0

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

core/sets.gms

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ sets
1515
numberOrder "set to assure that numeric values follow ascending order in the GAMS entry order (e.g. iterations and years used in loop statements)" / 1*2200 /
1616

1717
*** Save select compiler flags as sets, to make them accessible from the final gdx
18-
c_expname "c_expname as set for use in GDX" /%c_expname%/
19-
c_description "%c_description%" /"for model description, see explanatory text"/
20-
cm_GDPpopScen "cm_GDPpopScen as set for use in GDX" /%cm_GDPpopScen%/
18+
c_expname "c_expname as set for use in GDX" /%c_expname%/
19+
c_description "%c_description%" /"for model description, see explanatory text"/
20+
c_results_folder "%c_results_folder%" /"for cfg$results_folder, see explanatory text"/
21+
c_model_version "model version" /%c_model_version%/
22+
cm_GDPpopScen "cm_GDPpopScen as set for use in GDX" /%cm_GDPpopScen%/
2123

2224

2325
all_GDPpopScen "all possible GDP scenarios"

main.gms

+2
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ foo_msg.nr = 1; !! namely F-format (decimal) (and not E-format = scientific no
232232
***--------------------- Run name and description -------------------------
233233
$setGlobal c_expname default
234234
$setGlobal c_description REMIND run with default settings
235+
$setGlobal c_model_version REMIND model version will be automatically added during prepare.R
236+
$setGlobal c_results_folder REMIND results_folder will be automatically added during prepare.R
235237

236238
***------------------------------------------------------------------------------
237239
*' #### MODULES

scripts/start/checkFixCfg.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ checkFixCfg <- function(cfg, remindPath = ".", testmode = FALSE) {
2121
refcfg <- gms::readDefaultConfig(remindPath)
2222
remindextras <- c("backup", "remind_folder", "pathToMagpieReport", "cm_nash_autoconverge_lastrun", "var_luc",
2323
"gms$c_expname", "restart_subsequent_runs",
24-
"gms$cm_CES_configuration", "gms$c_description", "model", "renvLockFromPrecedingRun")
24+
"gms$cm_CES_configuration", "gms$c_description", "model", "renvLockFromPrecedingRun",
25+
"gms$c_model_version", "gms$c_results_folder")
2526
fail <- tryCatch(gms::check_config(cfg, reference_file = refcfg, modulepath = file.path(remindPath, "modules"),
2627
settings_config = file.path(remindPath, "config", "settings_config.csv"),
2728
extras = remindextras),

scripts/start/prepare.R

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ prepare <- function() {
123123
# add info from cfg into cfg$gams so it ends up in gams.
124124
cfg$gms$c_expname <- cfg$title
125125
cfg$gms$c_description <- substr(cfg$description, 1, 255)
126+
cfg$gms$c_results_folder <- substr(normalizePath(cfg$results_folder), 1, 255)
127+
cfg$gms$c_model_version <- gsub("[^a-zA-Z0-9]", "-", substr(cfg$model_version, 1, 255))
126128
# create modified version
127129
tmpModelFile <- sub(".gms", paste0("_", cfg$title, ".gms"), cfg$model)
128130
file.copy(cfg$model, tmpModelFile, overwrite = TRUE)

start_coupled.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ start_coupled <- function(path_remind, path_magpie, cfg_rem, cfg_mag, runname, m
125125
stop("### COUPLING ### REMIND didn't produce any gdx. Coupling iteration stopped!")
126126
}
127127

128-
# In the coupling, at the end of each REMIND run, report.R already automatically appends the MAgPIE
128+
# In the coupling, at the end of each REMIND run, reporting.R already automatically appends the MAgPIE
129129
# report of the previous MAgPIE run to the normal REMIND_generic reporting.
130130
# After the last coupling iteration: read this combined report from the REMIND output folder, set the
131131
# model name to 'REMIND-MAgPIE' and write the combined report directly to the 'output' folder.

0 commit comments

Comments
 (0)