Skip to content

Commit

Permalink
Merge pull request #479 from flohump/f_FSEC
Browse files Browse the repository at this point in the history
FSDP output script update
  • Loading branch information
flohump committed Nov 21, 2022
2 parents 775158f + 0d9c0fc commit eb543a3
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions scripts/output/projects/FSDP_collect.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,21 @@ if (!is.null(missing)) {
print(missing)
}

renameScenario <- function(rep) {
rep <- rep[!get("scenario") %like% "calibration_FSEC", ]
rep[, c("version", "scenset", "scenario") := tstrsplit(scenario, "_", fixed = TRUE)]
return(rep)
}

reg <- renameScenario(reg)
iso <- renameScenario(iso)
grid <- renameScenario(grid)

message("Saving rds files ...")

saveRDS(reg, file = file.path("output", paste(rev, "FSDP_reg.rds", sep = "_")), version = 2, compress = "xz")
saveRDS(iso, file = file.path("output", paste(rev, "FSDP_iso.rds", sep = "_")), version = 2, compress = "xz")
saveRDS(grid, file = file.path("output", paste(rev, "FSDP_grid.rds", sep = "_")), version = 2, compress = "xz")
saveRDS(reg, file = file.path("output", paste0(rev, "_FSDP_reg.rds")), version = 2, compress = "xz")
saveRDS(iso, file = file.path("output", paste0(rev, "_FSDP_iso.rds")), version = 2, compress = "xz")
saveRDS(grid, file = file.path("output", paste0(rev, "_FSDP_grid.rds")), version = 2, compress = "xz")

#save i_to_iso mapping
gdx <- file.path(outputdir[1], "fulldata.gdx")
Expand All @@ -233,12 +243,15 @@ saveRDS(reg2iso, file = file.path("output", "reg2iso.rds"), version = 2, compres
#save validation file
val <- file.path(outputdir[1], "validation.mif")
val <- as.data.table(read.quitte(val))
saveRDS(val, file = file.path("output", paste(rev, "FSDP_validation.rds", sep = "_")), version = 2, compress = "xz")
saveRDS(val, file = file.path("output", paste0(rev, "_FSDP_validation.rds")), version = 2, compress = "xz")

message("Plotting figures ...")
heatmapFSDP(reg, tableType = 1, file = file.path("output", paste(rev, "FSDP_heatmap1.jpg", sep = "")))
heatmapFSDP(reg, tableType = "2a", file = file.path("output", paste(rev, "FSDP_heatmap2a.jpg", sep = "")))
heatmapFSDP(reg, tableType = 3, file = file.path("output", paste(rev, "FSDP_heatmap3.jpg", sep = "_")))
spatialMapsFSDP(reg, iso, grid, reg2iso, file = file.path("output", paste(rev, "FSDP_spatialMaps.jpg", sep = "_")))
supplPlotsFSDP(reg, scenarioType = "all", file = file.path("output", paste(rev, "FSDP_supplPlots.jpg", sep = "_")))
SupplPlotsCropShr(gdx = gdx, file = file.path("output", paste(rev, "FSDP_supplPlotCropShr.jpg", sep = "_")) )
heatmapFSDP(reg, tableType = 1, file = file.path("output", paste0(rev, "_FSDP_heatmap1.png")))
heatmapFSDP(reg, tableType = "2a", file = file.path("output", paste0(rev, "_FSDP_heatmap2a.png")))
heatmapFSDP(reg, tableType = 3, file = file.path("output", paste0(rev, "_FSDP_heatmap3.png")))
bundlesFSDP(reg, file = file.path("output", paste0(rev, "_FSDP_bundle.png")))
spatialMapsFSDP(reg, iso, grid, reg2iso, file = file.path("output", paste0(rev, "_FSDP_spatialMaps.png")))
supplPlotsFSDP(reg, scenarioType = "all", file = file.path("output", paste0(rev, "_FSDP_supplPlots.png")))
SupplPlotsCropShr(gdx = gdx, file = file.path("output", paste0(rev, "_FSDP_supplPlotCropShr.png")) )
validationFSDP(reg, val = val, folder = "output")
dashboardFSDP(repReg = reg, repIso = iso, repGrid = grid, outputDir = "output", file = paste0(rev, "_FSDP_dashboard.html"))

0 comments on commit eb543a3

Please sign in to comment.