From bf17fa48176cec25360058faa15d111786a4455d Mon Sep 17 00:00:00 2001 From: R0slyn <roslyn.henry.08@aberdeen.ac.uk> Date: Thu, 1 Nov 2018 10:27:36 +0000 Subject: [PATCH] tweaks to create shock file script --- scripts/createShockFiles.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/createShockFiles.R b/scripts/createShockFiles.R index f330388e..991dd137 100644 --- a/scripts/createShockFiles.R +++ b/scripts/createShockFiles.R @@ -93,7 +93,7 @@ createShockFile = function(scenario){ if (dir.exists(file.path(baseOutputDir,ensDir))) { print(paste(ensDir, "exists. Creating shock file")) write.csv(paramValues, file.path(baseOutputDir,ensDir,"shocks.csv"), row.names=FALSE, quote=FALSE) - write.csv(shockValues, file.path(baseOutputDir,ensDir,"shocksRecord.csv"), row.names=FALSE, quote=FALSE) + write.csv(shockValues, file.path(baseOutputDir,ensDir,paste0("shocksRecord_",scenario[,Scenario],".csv")), row.names=FALSE, quote=FALSE) } else{ print(paste(ensDir, "does not exist. Stopping")) @@ -112,7 +112,8 @@ drawValue <- function(shockType, paramName){ randomValue } -baseDataDir = "/exports/csce/eddie/geos/groups/LURG/models/PLUM" +plumDirectory = "/exports/csce/eddie/geos/groups/LURG/models/PLUM" +baseDataDir = "/exports/csce/eddie/geos/groups/LURG/models/PLUM/plumv2/data" baseOutputDir="/exports/csce/eddie/geos/groups/LURG/models/PLUM/output" # "~/Downloads" shockDistFile = fread(file.path(baseDataDir, "shockDistributions.csv")) @@ -120,7 +121,7 @@ shockProbs = fread(file.path(baseDataDir,"shockProbabilities.csv")) ensembleFile = commandArgs(trailingOnly = TRUE)[1] -scenarioTable = fread(file.path(baseDataDir,"sims",ensembleFile)) +scenarioTable = fread(file.path(plumDirectory,ensembleFile)) for(i in 1:nrow(scenarioTable)){ #first if column exists -- GitLab