-
Notifications
You must be signed in to change notification settings - Fork 2
/
track2017_basin_at.sh
executable file
·244 lines (202 loc) · 8.87 KB
/
track2017_basin_at.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 Atlantic
## 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="gfs2017 gfs2019 gfs2019c" ;#experiment names
export mdplot="FY17 HRD5 HRD6" ;#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=emc.glopara
export webhost=emcrzdm.ncep.noaa.gov
export ftpdir=/home/people/emc/www/htdocs/gmb/$webhostid/vsdb/fv3q2fy19retro2c
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/track$$}
mkdir -p ${rundir}; cd $rundir || exit 8
#==================================================================
for storm in Arlene Bret Cindy Don Emily Franklin Gert Harvey Irma Jose Katia Lee Maria Nate Ophelia Philippe Rina ; do
case $storm in
Arlene) code1=al012017.dat; DATEST=20170419; DATEND=20170421;;
Bret) code1=al022017.dat; DATEST=20170419; DATEND=20170420;;
Cindy) code1=al032017.dat; DATEST=20170620; DATEND=20170623;;
Don) code1=al052017.dat; DATEST=20170717; DATEND=20170719;;
Emily) code1=al062017.dat; DATEST=20170731; DATEND=20170802;;
Franklin) code1=al072017.dat; DATEST=20170807; DATEND=20170810;;
Gert) code1=al082017.dat; DATEST=20170813; DATEND=20170817;;
Harvey) code1=al092017.dat; DATEST=20170817; DATEND=20170901;;
Irma) code1=al112017.dat; DATEST=20170830; DATEND=20170912;;
Jose) code1=al122017.dat; DATEST=20170905; DATEND=20170922;;
Katia) code1=al132017.dat; DATEST=20170905; DATEND=20170909;;
Lee) code1=al142017.dat; DATEST=20170915; DATEND=20170930;;
Maria) code1=al152017.dat; DATEST=20170916; DATEND=20170930;;
Nate) code1=al162017.dat; DATEST=20171004; DATEND=20171009;;
Ophelia) code1=al172017.dat; DATEST=20171009; DATEND=20171016;;
Philippe) code1=al182017.dat; DATEST=20171028; DATEND=20171029;;
Rina) code1=al192017.dat; DATEST=20171106; DATEND=20171109;;
esac
OCEAN=AL
#---------------------------------------------------------
#---------------------------------------------------------
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/aal01${year}.dat ]; then
tpcdata=/nhc/noscrub/data/atcf-noaa
cp ${tpcdata}/aid_nws/aal*${year}*.dat ${tpctrack}/.
cp ${tpcdata}/btk/bal*${year}*.dat ${tpctrack}/.
elif [ -s $scrdir/tpctrack/${year}/aal01${year}.dat ]; then
tpcdata=$scrdir/tpctrack
cp ${tpcdata}/${year}/aal*.dat ${tpctrack}/.
cp ${tpcdata}/${year}/bal*.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 = gfs2016 ]; then nameold="GFSX" ; fi
if [ $exp = fv3gfdlmp ]; then nameold="PRFV"; fi
if [ $exp = gfs2017 ]; then nameold="FY17" ; fi
if [ $exp = gfs2019 ]; then nameold="FY19" ; fi
if [ $exp = gfs2019c ]; then nameold="FY19" ; 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 EMX UKM OFCL"
#newlistt=${newlist}"AVNO HWRF GFDL EMX UKM OFCL"
#newlisti=${newlist}"AVNO"
#newlistt=${newlist}"AVNO"
newlisti=${newlist}
newlistt=${newlist}
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 = "AL" ]; then place="Atlantic"; 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_al.t.txt tracks_${storm}.t.txt
put tracks_al.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_al.t.txt ${savedir}/tracks_${storm}.t.txt
#cp ${execdir}/tracks_al.i.txt ${savedir}/tracks_${storm}.i.txt
#---end of individual storm
done
#---end of individual storm
exit