-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1368 from orichters/smallfix4
allow gamscompile to get input data, update regexp in main.gms
- Loading branch information
Showing
15 changed files
with
177 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
updateInputData <- function(cfg, remindPath = ".", verbose = TRUE) { | ||
# write name of corresponding CES file to datainput.gms | ||
|
||
cfg$gms$cm_CES_configuration <- calculate_CES_configuration(cfg) | ||
replace_in_file(file = file.path(remindPath, "modules/29_CES_parameters/load/datainput.gms"), | ||
content = paste0('$include "', | ||
"./modules/29_CES_parameters/load/input/", | ||
cfg$gms$cm_CES_configuration, ".inc\""), | ||
subject = "CES INPUT") | ||
|
||
|
||
if(file.exists("input/source_files.log")) { | ||
input_old <- readLines(file.path(remindPath, "input/source_files.log"))[c(1,2,3)] | ||
} else { | ||
input_old <- "no_data" | ||
} | ||
input_new <- c(paste0("rev",cfg$inputRevision,"_", madrat::regionscode(cfg$regionmapping),"_", tolower(cfg$model_name),".tgz"), | ||
paste0("rev",cfg$inputRevision,"_", madrat::regionscode(cfg$regionmapping),ifelse(cfg$extramappings_historic == "","",paste0("-", madrat::regionscode(cfg$extramappings_historic))),"_", tolower(cfg$validationmodel_name),".tgz"), | ||
paste0("CESparametersAndGDX_",cfg$CESandGDXversion,".tgz")) | ||
# download and distribute needed data | ||
if (! setequal(input_new, input_old) || isTRUE(cfg$force_download)) { | ||
message(if (isTRUE(cfg$force_download)) "You set 'cfg$force_download = TRUE'" | ||
else "Your input data are outdated or in a different regional resolution", | ||
". New input data are downloaded and distributed.") | ||
download_distribute(files = input_new, | ||
repositories = cfg$repositories, # defined in your environment variables | ||
modelfolder = remindPath, | ||
debug = FALSE, | ||
stopOnMissing = TRUE) | ||
} else if (verbose) { | ||
message("No input data downloaded and distributed. To enable that, delete input/source_files.log or set cfg$force_download to TRUE.") | ||
} | ||
|
||
return(cfg) | ||
} |
Oops, something went wrong.