Skip to content

Commit

Permalink
Revert unintended changes from previous commit in updateInputData.R a…
Browse files Browse the repository at this point in the history
…nd commit what was actually intended in test_01-inputdata.R
  • Loading branch information
dklein-pik committed Oct 10, 2024
1 parent ee30e4d commit b1ae937
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/start/updateInputData.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ updateInputData <- function(cfg, remindPath = ".", gamsCompile = FALSE) {
}
regicode <- madrat::regionscode(file.path(remindPath, cfg$regionmapping))
input_new <- c(paste0("rev",cfg$inputRevision,"_",regicode,"_", tolower(cfg$model_name),".tgz"),
paste0("rev",cfg$inputRevision,"_",regicode,ifelse(cfg$extramappings_historic == "","",paste0("-", madrat::regionscode(cfg$extramappings_historic))),"_", tolower(cfg$validationmodel_name),".tzz"),
paste0("rev",cfg$inputRevision,"_",regicode,ifelse(cfg$extramappings_historic == "","",paste0("-", madrat::regionscode(cfg$extramappings_historic))),"_", tolower(cfg$validationmodel_name),".tgz"),
paste0("CESparametersAndGDX_",cfg$CESandGDXversion,".tgz"))

# Specify for each element of input_new whether to stop if the respective file could not be downloaded
Expand Down
9 changes: 8 additions & 1 deletion tests/testthat/test_01-inputdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ test_that("Are all input data files present?", {
missinginput <- missingInputData(path = "../..")
if (length(missinginput) > 0) {
lockID <- gms::model_lock(folder = "../..")
updateInputData(cfg = gms::readDefaultConfig("../.."), remindPath = "../..")
w <- capture_warning(updateInputData(cfg = gms::readDefaultConfig("../.."), remindPath = "../.."))
# ignore warning about missing historical.mif, raise warning if there were other wargnings
ignore <- "File historical.mif seems to be missing!"
if (!w$message %in% ignore) {
warning(paste0("'updateInputData' raised the following wargnings\n", paste(w, collapse = "\n")))
}
gms::model_unlock(lockID)
missinginput <- missingInputData(path = "../..")
# remove historical.mif since it is optional
missinginput <- grep("historical.mif", missinginput, invert = TRUE, value = TRUE)
if (length(missinginput) > 0) {
warning("Missing input files: ", paste(missinginput, collapse = ", "))
}
Expand Down

0 comments on commit b1ae937

Please sign in to comment.