-
Notifications
You must be signed in to change notification settings - Fork 2
/
track2014_basin_wp.sh
executable file
·244 lines (203 loc) · 9.04 KB
/
track2014_basin_wp.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
#!/bin/ksh
set -x
## plot mean tracks of individual storms in the Weatern Pacific
## Fanglin Yang, March 2008: original copy adopted from HWRF. Restructured and added driver scripts.
## Fanglin Yang, March 2013: Generalized for running on WCOSS and THEIA
#-------------------------------------------------------------------------------------
export expdir=/global/noscrub/emc.glopara/archive ;#experiment data archive directory
export mdlist="pr4devbs14" ;#experiment names
export mdplot="4dvb" ;#names to be shown on plots, limitted to 4 letters
export cyc="00 06 12 18" ;#forecast cycles to be included in verification
export doftp="YES" ;#whether or not sent maps to ftpdir
export webhostid=wd20rt
export webhost=emcrzdm.ncep.noaa.gov
export ftpdir=/home/people/emc/www/htdocs/gmb/$webhostid/vsdb/pr4devbs14
machine=WCOSS
#-------------------------------------------------------------------------------------
#---------------------------------------------------------
#---Most likely you do not need to change anything below--
#---------------------------------------------------------
#-------------------------------------------------------------------------------------
if [ $machine = THEIA ]; then
export scrdir=/scratch4/NCEPDEV/global/save/Fanglin.Yang/VRFY/hurtrack
export STMP="/scratch4/NCEPDEV/stmp3"
export NDATE=/scratch4/NCEPDEV/global/save/Fanglin.Yang/VRFY/vsdb/nwprod/util/exec/ndate
elif [ $machine = WCOSS ]; then
export scrdir=/global/save/Fanglin.Yang/VRFY/hurtrack
export STMP="/stmpd2"
export NDATE=/nwprod/util/exec/ndate
fi
export rundir=${rundir:-$STMP/$LOGNAME/track2014_wp_pr4devbs14}
mkdir -p ${rundir}; cd $rundir || exit 8
#==================================================================
for storm in Lingling Kajiki Faxai Peipah Tapah Hagibis Neoguri Rammasun Matmo Halong Nakri Fengshen Kalmaegi Fung-wong Kammuri Phanfone Vongfong Nuri Sinlaku Hagupit Halong ; do
case $storm in
Lingling) codd1=wp012014.dat; DATEST=20140118; DATEND=20140120;;
Kajiki) code1=wp022014.dat; DATEST=20140131; DATEND=20140202;;
Faxai) code1=wp032014.dat; DATEST=20140228; DATEND=20140305;;
Peipah) code1=wp052014.dat; DATEST=20140405; DATEND=20140414;;
Tapah) code1=wp062014.dat; DATEST=20140428; DATEND=20140430;;
Hagibis) code1=wp072014.dat; DATEST=20140614; DATEND=20140617;;
Neoguri) code1=wp082014.dat; DATEST=20140704; DATEND=20140710;;
Rammasun) code1=wp092014.dat; DATEST=20140712; DATEND=20140719;;
Matmo) code1=wp102014.dat; DATEST=20140718; DATEND=20140723;;
Halong) code1=wp112014.dat; DATEST=20140729; DATEND=20140810;;
Nakri) code1=wp122014.dat; DATEST=20140802; DATEND=20140804;;
Fengshen) code1=wp132014.dat; DATEST=20140907; DATEND=20140910;;
Kalmaegi) code1=wp152014.dat; DATEST=20140912; DATEND=20140916;;
Fung-wong) code1=wp162014.dat; DATEST=20140918; DATEND=20140923;;
Kammuri) code1=wp172014.dat; DATEST=20140924; DATEND=20140929;;
Phanfone) code1=wp182014.dat; DATEST=20140929; DATEND=20141006;;
Vongfong) code1=wp192014.dat; DATEST=20141003; DATEND=20141014;;
Nuri) code1=wp202014.dat; DATEST=20141031; DATEND=20141105;;
Sinlaku) code1=wp212014.dat; DATEST=20141128; DATEND=20141129;;
Hagupit) code1=wp222014.dat; DATEST=20141201; DATEND=20141202;;
Halong) code1=wp792014.dat; DATEST=20140729; DATEND=20140803;;
esac
OCEAN=WP
#---------------------------------------------------------
#---------------------------------------------------------
set -A mdname $mdlist; set -A mdpt $mdplot
execdir=${rundir}/${storm} ;# working directory
rm -r $execdir; mkdir -p $execdir
cd $execdir; chmod u+rw *
years=`echo $DATEST |cut -c 1-4 `
yeare=`echo $DATEND |cut -c 1-4 `
if [ $years -ne $yeare ]; then
echo " years=$years, yeare=$yeare. Must have years=yeare. exit"
exit
fi
export year=$years
## copy HPC/JTWC tracks to working directory (HPC's tracks sometime do not match with real-time tracks)
tpctrack=${execdir}/tpctrack ;#place to hold HPC original track data
mkdir -p $tpctrack
#TPC Atlantic and Eastern Pacific tracks
#if [ -s /nhc/noscrub/data/atcf-noaa/aid_nws/aep01${year}.dat ]; then
# tpcdata=/nhc/noscrub/data/atcf-noaa
# cp ${tpcdata}/aid_nws/aep*${year}*.dat ${tpctrack}/.
# cp ${tpcdata}/btk/bep*${year}*.dat ${tpctrack}/.
#elif [ -s $scrdir/tpctrack/${year}/aep01${year}.dat ]; then
# tpcdata=$scrdir/tpctrack
# cp ${tpcdata}/${year}/aep*.dat ${tpctrack}/.
# cp ${tpcdata}/${year}/bep*.dat ${tpctrack}/.
#else
# echo" HPC track not found, exit"
# exit 8
#fi
JTWC Western Pacific tracks
jtwcdata=/nhc/noscrub/data/atcf-navy
cp ${jtwcdata}/aid/awp*${year}.dat ${tpctrack}/.
cp ${jtwcdata}/btk/bwp*${year}.dat ${tpctrack}/.
#------------------------------------------------------------------------
# insert experiment track to TPC track for all runs and for all BASINs
#------------------------------------------------------------------------
newlist=""
fout=24
nexp=`echo $mdlist |wc -w`
ncyc=`echo $cyc |wc -w |sed 's/ //g'`
if [ $ncyc -eq 3 ]; then ncyc=2; fi
fout=`expr $fout \/ $ncyc `
n=0
if [ $nexp -gt 0 ]; then
for exp in $mdlist; do
## cat experiment track data for each exp
nameold=`echo $exp |cut -c 1-4 ` ;#current fcst always uses first 4 letters of experiment name
nameold=`echo $nameold |tr "[a-z]" "[A-Z]" `
#namenew=`echo $exp |cut -c 1-4 `
namenew=${mdpt[$n]} ; n=$((n+1))
namenew=`echo $namenew |tr "[a-z]" "[A-Z]" `
export newlist=${newlist}"${namenew} " ;#donot delete the space at the end
dump=.gfs.
if [ $exp = fim ]; then
dump=.fim.
nameold=" F8C"
fi
outfile=${execdir}/atcfunix.$exp.$year
if [ -s $outfile ]; then rm $outfile; fi
touch $outfile
indir=${expdir}/$exp
date=${DATEST}00
until [ $date -gt ${DATEND}18 ] ; do
infile=$indir/atcfunix${dump}$date
if [ -s $infile ];
if [ -s infiletmp ]; then rm infiletmp; fi
sed "s?$nameold?$namenew?g" $infile >infiletmp
then cat infiletmp >> $outfile
fi
date=`$NDATE +$fout $date`
done
## insert experiment track into TPC tracks
for BASIN in $OCEAN; do
$scrdir/sorc/insert_new.sh $exp $BASIN $year $tpctrack $outfile $execdir
done
done ;#end of experiment loop
else
ln -fs $tpctrack/* .
fi
#------------------------------------------------------------------------
#------------------------------------------------------------------------
# prepare data for GrADS graphics
#------------------------------------------------------------------------
for BASIN in $OCEAN; do
bas=`echo $BASIN |tr "[A-Z]" "[a-z]" `
## copy test cards, replace dummy exp name MOD# with real exp name
cp ${scrdir}/sorc/card.i .
cp ${scrdir}/sorc/card.t .
cat >stormlist <<EOF
$code1
EOF
cat card.i stormlist >card${year}_${bas}.i
cat card.t stormlist >card${year}_${bas}.t
#newlisti=${newlist}"AVNO HWRF GFDL JTWC "
#newlistt=${newlist}"AVNO HWRF GFDL JTWC"
newlisti=${newlist}"AVNO"
newlistt=${newlist}"AVNO"
nint=`echo $newlisti |wc -w` ;#number of process for intensity plot, to replace NUMINT in card.i
ntrc=`echo $newlistt |wc -w` ;#number of process for track plot, to replace NUMTRC in card.t
nint=`expr $nint + 0 ` ;#remove extra space
ntrc=`expr $ntrc + 0 `
sed -e "s/MODLIST/${newlisti}/g" -e "s/NUMINT/${nint}/g" card${year}_$bas.i >card_$bas.i
sed -e "s/MODLIST/${newlistt}/g" -e "s/NUMTRC/${ntrc}/g" card${year}_$bas.t >card_$bas.t
## produce tracks.t.txt etc
cp $tpctrack/b*${year}.dat .
${scrdir}/sorc/nhcver.x card_${bas}.t tracks_${bas}.t $execdir
${scrdir}/sorc/nhcver.x card_${bas}.i tracks_${bas}.i $execdir
## create grads files tracks_${bas}.t.dat etc for plotting
${scrdir}/sorc/top_tvercut.sh ${execdir}/tracks_${bas}.t.txt $scrdir/sorc
${scrdir}/sorc/top_ivercut.sh ${execdir}/tracks_${bas}.i.txt $scrdir/sorc
## copy grads scripts and make plots
if [ $BASIN = "WP" ]; then place="West-Pacific"; fi
period="${storm}__${DATEST}_${DATEND}_${ncyc}cyc"
cp ${scrdir}/sorc/*iver*.gs .
cp ${scrdir}/sorc/*tver*.gs .
grads -bcp "run top_iver.gs tracks_${bas}.i $year $place $period"
grads -bcp "run top_tver_250.gs tracks_${bas}.t $year $place $period"
mv tracks_${bas}.i.gif tracks_${storm}.i.gif
mv tracks_${bas}.t.gif tracks_${storm}.t.gif
#----------------------------
done ;# end of BASIN loop
#----------------------------
if [ $doftp = "YES" ]; then
cat << EOF >ftpin
cd $ftpdir
mkdir track
cd track
binary
promt
mput tracks_${storm}*.gif
put tracks_${bas}.t.txt tracks_${storm}.t.txt
put tracks_${bas}i.txt tracks_${storm}.i.txt
quit
EOF
sftp ${webhostid}@${webhost} <ftpin
fi
## save tracks
#savedir=${scrdir}/arch_trak/${mdname[0]}$years$yeare
#mkdir -p $savedir
#cp ${execdir}/tracks_${storm}*.gif ${savedir}/.
#cp ${execdir}/tracks_${bas}.t.txt ${savedir}/tracks_${storm}.t.txt
#cp ${execdir}/tracks_${bas}.i.txt ${savedir}/tracks_${storm}.i.txt
#---end of individual storm
done
#---end of individual storm
exit