forked from NCAR/MPAS-Workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MeanBackground.csh
executable file
·77 lines (62 loc) · 1.94 KB
/
MeanBackground.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
#!/bin/csh -f
date
# Setup environment
# =================
source config/experiment.csh
source config/filestructure.csh
source config/tools.csh
source config/modeldata.csh
source config/builds.csh
source config/environment.csh
set yymmdd = `echo ${CYLC_TASK_CYCLE_POINT} | cut -c 1-8`
set hh = `echo ${CYLC_TASK_CYCLE_POINT} | cut -c 10-11`
set thisCycleDate = ${yymmdd}${hh}
set thisValidDate = ${thisCycleDate}
source ./getCycleVars.csh
# static work directory
set self_WorkDir = $MeanBackgroundDirs[1]
echo "WorkDir = ${self_WorkDir}"
mkdir -p ${self_WorkDir}
cd ${self_WorkDir}
# other static variables
set self_StateDirs = ($prevCyclingFCDirs)
set self_StatePrefix = ${FCFilePrefix}
set memberPrefix = ${self_StatePrefix}.${fileDate}mem
set meanName = ${self_StatePrefix}.$fileDate.nc
set varianceName = ${self_StatePrefix}.$fileDate.variance.nc
# ================================================================================================
## link background members
set member = 1
while ( $member <= ${nEnsDAMembers} )
set appMember = `${memberDir} ensemble $member "{:03d}"`
# set appMember = printf "%03d" $member`
ln -sfv $self_StateDirs[$member]/${meanName} ./${memberPrefix}${appMember}
@ member++
end
if (${nEnsDAMembers} == 1) then
## pass-through for mean
ln -sfv $self_StateDirs[1]/${meanName} ./
else
## make copy for mean
cp $self_StateDirs[1]/${meanName} ./
## make copy for variance
cp $self_StateDirs[1]/${meanName} ./${varianceName}
# Run the executable
# ==================
set arg1 = ${self_WorkDir}
set arg2 = ${meanName}
set arg3 = ${varianceName}
set arg4 = ${memberPrefix}
set arg5 = ${nEnsDAMembers}
ln -sfv ${meanStateBuildDir}/${meanStateExe} ./
mpiexec ./${meanStateExe} "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" >& log
# Check status
# ============
grep 'All done' log
if ( $status != 0 ) then
echo "ERROR in $0 : mean state application failed" > ./FAIL
exit 1
endif
endif
date
exit 0