-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·246 lines (199 loc) · 3.39 KB
/
test.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/bin/bash
#set -x
##############
# test array number
##############
fldir=/lfs/h2/emc/ptmp/emc.lam/rrfs/v0.5.0/prod/rrfs.20230523/00
numfile=`ls $fldir/rrfs.*.prslev.f*.conus_3km.grib2 | wc | awk '{ print $1 }'`
if [ $numfile > 8 ]; then
echo $numfile
fi
indx="03 04 05"
cyc=08
for i in $indx
do
if [ "$cyc" == $i ]; then
echo $cyc
fi
done
exit
spinup=( "03" "04" 05" "06" "07" "08")
#for i in
#do
#done
topline=`grep bash test.sh | head -n1 | tail -n1`
if [ "$topline" == "DEAD" ]; then
echo $topline
else
echo non string
fi
exit
exit
CYCL_HRS_SPINSTART=( \
)
if [ ${#CYCL_HRS_SPINSTART[@]} -gt 0 ]; then
echo there are parameters
fi
hh=8
tt="${CYCL_HRS_SPINSTART[${hh#0}]}"
echo $tt
exit
for i in $(seq -f "%03g" 0 80)
do
#ifl=/gpfs/dell1/nco/ops/com/gfs/prod/enkfgdas.20211118/00/atmos/mem064/gdas.t00z.atmf006.nc
echo $i
done
#############
# extract substring
# ${string:P:L}
#Here P is a number that indicates the starting index of the substring and L is the length of the substring.
#If you omit the L parameter then the rest of the string is returned, starting from position P
#############
mydate=2021082700
echo ${mydate:0:8}
exit
##############
# test array number
##############
CYCL_HRS_SPINSTART=( \
"1" \
"2" \
"3" \
"4" \
"5" \
"6" \
"7" \
"8" \
"9" \
)
hh=8
tt="${CYCL_HRS_SPINSTART[${hh#0}]}"
echo $tt
exit
##############
# test case
##############
test=23
case $test in
11)
taskname=get_extrn_lbcs
;;
12)
taskname=make_ics
;;
13)
taskname=make_lbcs_00
;;
21)
taskname=prep_cyc_spinup
;;
22)
taskname=anal_gsi_input_spinup
;;
23)
taskname=run_fcst_spinup
;;
31)
taskname=prep_cyc_prod
;;
32)
taskname=anal_gsi_input_prod
;;
33)
taskname=run_fcst_prod
;;
esac
##############
# test if
##############
CRES=C3359
if [ $CRES = 'C3359' ]; then
echo $CRES
fi
exit
##############
# test sed
##############
files=`/usr/bin/ls -1 1*`
for file in $files
do
sed 's/.bashrc/bin\'/loadp'/g' $file > $file.new
exit
mv $file.new $file
done
files='drive_plots.xml'
for file in $files
do
sed '171,177s/fv3lamdax/rdas/; 171,177s/fv3lam/rrfs/' $file > $file.new
mv $file.new $file
done
exit
hh=06
#for ((i=0;i<5;i++))
for ((i=0;i<${hh};i++))
do
echo $i
done
exit
CYCL_HRS_SPINSTART=( \
"06" \
"18" \
)
CYCL_HRS_PRODSTART=( \
"12" \
"00" \
)
tindx="0 1"
for i in $tindx
do
cyc_spinstart=${CYCL_HRS_SPINSTART[${i}]}
cyc_prodstart=${CYCL_HRS_PRODSTART[${i}]}
if [ ${cyc_prodstart} = 00 ]; then
cyc_prodstart=24
fi
if [ $hh -ge $cyc_spinstart -a $hh -le $cyc_prodstart ]; then
let tm=cyc_prodstart-hh
tmmark=$(printf "%02d" $tm)
echo this_cyc: $hh spinup_start:$cyc_spinstart prod_start:$cyc_prodstart tmmark:$tmmark
break
else
echo this is not spinup cycle, no TM value
fi
done
exit
#for cyc_start in ${CYCL_HRS_PRODSTART[@]}
#do
#done
exit
#if [ $hh -lt 12 ]; then
# echo $hh
# let tm=hh-3
# echo $tm
# tmmark=$(printf "%02d" $tm)
# echo $tmmark
#fi
for cyc_start in ${CYCL_HRS_PRODSTART[@]}
do
echo $cyc_start
if [ ${cyc_start} = 00 ]; then
cyc_start=24
#else
# this_cyc_start=$cyc_start
fi
echo $cyc_start
# if [ $hh -ge $cyc_start ]; then
# this_spinup_time=$cyc_start
# fi
done
exit
let tm=hh-this_spinup_time
tmmark=$(printf "%02d" $tm)
echo $tmmark
exit
jobpre=regional_forecast
BKTYPE=0
if [ ${BKTYPE} = 0 -a ${jobpre} = regional_forecast ]; then
echo forecast
elif [ "${jobpre}" = "regional_bufrpost" ]; then
echo bufr
fi