-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_gsiobserver.sh
executable file
·145 lines (132 loc) · 4.35 KB
/
run_gsiobserver.sh
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh
# do hybrid observer.
if [ -z $charnanal2 ]; then
export charnanal2=$charnanal
fi
if [ $charnanal == "control" ] && [ $RES_CTL -le 384 ]; then
# run observer on full res control forecast grid
export LONA=$LONB_CTL
export LATA=$LATB_CTL
export JCAP=$JCAP_CTL
fi
##export CLEAN="NO"
export NLAT=$((${LATA}+2))
export CO2DIR=$fixgsi
# charanal is an env var set in parent script
if [ $ANALINC -eq 6 ]; then
export SIGANL03=${datapath2}/sanl_${analdate}_fhr03_${charnanal}
export SIGANL04=${datapath2}/sanl_${analdate}_fhr04_${charnanal}
export SIGANL05=${datapath2}/sanl_${analdate}_fhr05_${charnanal}
export SIGANL06=${datapath2}/sanl_${analdate}_fhr06_${charnanal}
export SIGANL07=${datapath2}/sanl_${analdate}_fhr07_${charnanal}
export SIGANL08=${datapath2}/sanl_${analdate}_fhr08_${charnanal}
export SIGANL09=${datapath2}/sanl_${analdate}_fhr09_${charnanal}
elif [ $ANALINC -eq 1 ]; then
export SIGANL06=${datapath2}/sanl_${analdate}_fhr01_${charnanal}
else
echo "ANALINC must be 1 or 6"
exit
fi
export BIASO=${datapath2}/${PREINP}abias
export BIASO_PC=${datapath2}/${PREINP}abias_pc
export SATANGO=${datapath2}/${PREINP}satang
export DTFANL=${datapath2}/${PREINP}dtfanl.nc
echo "NOCONV:" $NOCONV
if [ $skipcat == 'false' ]; then
if [ $NOCONV == 'YES' ]; then
diagfile=${datapath2}/diag_amsua_n15_ges.${analdate}_${charnanal2}.nc4
else
diagfile=${datapath2}/diag_conv_uv_ges.${analdate}_${charnanal2}.nc4
fi
else
if [ $NOCONV == 'YES' ]; then
diagfile=${datapath2}/gsitmp_${charnanal2}/pe0000.amsua_n15_01.nc4
else
diagfile=${datapath2}/gsitmp_${charnanal2}/pe0000.conv_uv_01.nc4
fi
fi
echo "skipcat $skipcat diagfile $diagfile"
if [ $cleanup_observer == 'true' ]; then
if [ $skipcat == 'false' ]; then
echo "removing diag files"
/bin/rm -f ${datapath2}/diag*${charnanal2}*nc4
else
echo "removing ${datapath2}/gsitmp_${charnanal2}"
/bin/rm -rf ${datapath2}/gsitmp_${charnanal2}
fi
fi
ls -l $diagfile
niter=1
alldone='no'
if [ -s ${diagfile} ]; then
alldone='yes'
fi
while [ $alldone == "no" ] && [ $niter -le $nitermax ]; do
export JCAP_A=$JCAP
export JCAP_B=$JCAP_CTL
export VERBOSE=YES
export OMP_NUM_THREADS=$gsi_control_threads
export OMP_STACKSIZE=2048M
#cores=`python -c "print (${NODES} - 1) * ${corespernode}"`
export nprocs=`expr $cores \/ $OMP_NUM_THREADS`
export mpitaskspernode=`expr $corespernode \/ $OMP_NUM_THREADS`
echo "running with $OMP_NUM_THREADS threads ..."
if [ -z $biascorrdir ]; then # cycled bias correction files
export GBIAS=${datapathm1}/${PREINPm1}abias
export GBIAS_PC=${datapathm1}/${PREINPm1}abias_pc
export GBIASAIR=${datapathm1}/${PREINPm1}abias_air
export ABIAS=${datapath2}/${PREINP}abias
else # externally specified bias correction files.
#biasdate=`incdate $obdate -6`
biasdate=$obdate
hhbias=`echo $biasdate | cut -c9-10`
export GBIAS=${biascorrdir}/${biasdate}/gdas.t${hhbias}z.abias
export GBIAS_PC=${biascorrdir}/${biasdate}/gdas.t${hhbias}z.abias_pc
export GBIASAIR=${biascorrdir}/${biasdate}/gdas.t${hhbias}z.abias_air
export ABIAS=${biascorrdir}/${biasdate}//gdas.t${hhbias}z.abias
fi
export GSATANG=$fixgsi/global_satangbias.txt # not used, but needs to exist
export lread_obs_save=".false."
export lread_obs_skip=".false."
export HXONLY='YES'
if [ -s ${diagfile} ]; then
echo "gsi hybrid observer already completed"
echo "yes" > ${current_logdir}/run_gsi_observer.log 2>&1
exit 0
fi
echo "${analdate} compute gsi hybrid observer `date`"
export tmpdir=$datapath2/gsitmp_${charnanal2}
/bin/rm -rf $tmpdir
mkdir -p $tmpdir
/bin/cp -f $datapath2/hybens_info $tmpdir
sh ${enkfscripts}/${rungsi}
status=$?
if [ $status -ne 0 ]; then
echo "gsi hybrid observer did not complete sucessfully"
exitstat=1
else
if [ ! -s ${diagfile} ]; then
ls -l ${diagfile}
echo "gsi hybrid observer did not complete sucessfully"
exitstat=1
else
echo "gsi hybrid completed sucessfully"
exitstat=0
fi
fi
if [ $exitstat -eq 0 ]; then
alldone='yes'
else
echo "some files missing, try again .."
niter=$((niter+1))
fi
done
if [ $alldone == 'no' ]; then
echo "Tried ${nitermax} times and to do gsi hybrid observer and failed"
echo "no" > ${current_logdir}/run_gsi_observer.log 2>&1
else
echo "yes" > ${current_logdir}/run_gsi_observer.log 2>&1
if [ $skipcat == 'false' ]; then
/bin/rm -rf $tmpdir
fi
fi