forked from NCAR/MPAS-Workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetupWorkflow.csh
executable file
·125 lines (109 loc) · 4.05 KB
/
SetupWorkflow.csh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/csh -f
## create experiment environment
source generateExperimentConfig.csh
set workflowParts = ( \
GetGFSanalysis.csh \
UngribColdStartIC.csh \
GenerateColdStartIC.csh \
GetWarmStartIC.csh \
GetObs.csh \
ObsToIODA.csh \
getCycleVars.csh \
tools \
config \
scenarios \
MeanAnalysis.csh \
MeanBackground.csh \
PrepRTPP.csh \
RTPP.csh \
CleanRTPP.csh \
GenerateABEInflation.csh \
PrepVariational.csh \
EnsembleOfVariational.csh \
include \
)
foreach part ($workflowParts)
cp -rP $part ${mainScriptDir}/
end
cd ${mainScriptDir}
## load the workflow settings
source config/workflow.csh
cd -
set AppAndVerify = AppAndVerify
## PrepJEDIVariational, Variational, VerifyObsDA, VerifyModelDA*, CleanVariational
# *VerifyModelDA is non-functional and unused
set taskBaseScript = Variational
set WrapperScript=${mainScriptDir}/${AppAndVerify}DA.csh
sed -e 's@wrapWorkDirsTEMPLATE@CyclingDADirs@' \
-e 's@wrapWorkDirsBenchmarkTEMPLATE@BenchmarkCyclingDADirs@' \
-e 's@AppScriptNameTEMPLATE@Variational@' \
-e 's@taskBaseScriptTEMPLATE@'${taskBaseScript}'@' \
-e 's@wrapStateDirsTEMPLATE@prevCyclingFCDirs@' \
-e 's@wrapStatePrefixTEMPLATE@'${FCFilePrefix}'@' \
-e 's@wrapStateTypeTEMPLATE@DA@' \
-e 's@wrapWindowHRTEMPLATE@'${CyclingWindowHR}'@' \
${AppAndVerify}.csh > ${WrapperScript}
chmod 744 ${WrapperScript}
${WrapperScript}
rm ${WrapperScript}
## Forecast
echo "Making Forecast job script"
set JobScript=${mainScriptDir}/Forecast.csh
sed -e 's@WorkDirsTEMPLATE@CyclingFCDirs@' \
-e 's@StateDirsTEMPLATE@CyclingDAOutDirs@' \
-e 's@fcLengthHRTEMPLATE@'${CyclingWindowHR}'@' \
-e 's@fcIntervalHRTEMPLATE@'${CyclingWindowHR}'@' \
-e 's@deleteZerothForecastTEMPLATE@True@' \
forecast.csh > ${JobScript}
chmod 744 ${JobScript}
## ExtendedMeanFC
echo "Making ExtendedMeanFC job script"
set JobScript=${mainScriptDir}/ExtendedMeanFC.csh
sed -e 's@WorkDirsTEMPLATE@ExtendedMeanFCDirs@' \
-e 's@StateDirsTEMPLATE@MeanAnalysisDirs@' \
-e 's@fcLengthHRTEMPLATE@'${ExtendedFCWindowHR}'@' \
-e 's@fcIntervalHRTEMPLATE@'${ExtendedFC_DT_HR}'@' \
-e 's@deleteZerothForecastTEMPLATE@False@' \
forecast.csh > ${JobScript}
chmod 744 ${JobScript}
## ExtendedEnsFC
echo "Making ExtendedEnsFC job script"
set JobScript=${mainScriptDir}/ExtendedEnsFC.csh
sed -e 's@WorkDirsTEMPLATE@ExtendedEnsFCDirs@' \
-e 's@StateDirsTEMPLATE@CyclingDAOutDirs@' \
-e 's@fcLengthHRTEMPLATE@'${ExtendedFCWindowHR}'@' \
-e 's@fcIntervalHRTEMPLATE@'${ExtendedFC_DT_HR}'@' \
-e 's@deleteZerothForecastTEMPLATE@False@' \
forecast.csh > ${JobScript}
chmod 744 ${JobScript}
## PrepJEDIHofX{{state}}, HofX{{state}}, CleanHofX{{state}}
## VerifyObs{{state}}, CompareObs{{state}},
## VerifyModel{{state}}, CompareModel{{state}}
foreach state (AN BG EnsMeanBG MeanFC EnsFC)
if (${state} == AN) then
set TemplateVariables = (CyclingDAOutDirs ${ANFilePrefix} ${DAVFWindowHR})
else if (${state} == BG) then
set TemplateVariables = (prevCyclingFCDirs ${FCFilePrefix} ${DAVFWindowHR})
else if (${state} == EnsMeanBG) then
set TemplateVariables = (MeanBackgroundDirs ${FCFilePrefix} ${DAVFWindowHR})
else if (${state} == MeanFC) then
set TemplateVariables = (ExtendedMeanFCDirs ${FCFilePrefix} ${FCVFWindowHR})
else if (${state} == EnsFC) then
set TemplateVariables = (ExtendedEnsFCDirs ${FCFilePrefix} ${FCVFWindowHR})
endif
set taskBaseScript = HofX${state}
set WrapperScript=${mainScriptDir}/${AppAndVerify}${state}.csh
sed -e 's@wrapWorkDirsTEMPLATE@Verify'${state}'Dirs@' \
-e 's@wrapWorkDirsBenchmarkTEMPLATE@BenchmarkVerify'${state}'Dirs@' \
-e 's@AppScriptNameTEMPLATE@HofX@' \
-e 's@taskBaseScriptTEMPLATE@'${taskBaseScript}'@' \
-e 's@wrapStateDirsTEMPLATE@'$TemplateVariables[1]'@' \
-e 's@wrapStatePrefixTEMPLATE@'$TemplateVariables[2]'@' \
-e 's@wrapStateTypeTEMPLATE@'${state}'@' \
-e 's@wrapWindowHRTEMPLATE@'$TemplateVariables[3]'@' \
${AppAndVerify}.csh > ${WrapperScript}
chmod 744 ${WrapperScript}
${WrapperScript}
rm ${WrapperScript}
end
exit 0