-
Notifications
You must be signed in to change notification settings - Fork 0
/
diag.sh
executable file
·451 lines (386 loc) · 9.78 KB
/
diag.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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
#!/bin/sh
DIAGDIR=`dirname $0`
. $DIAGDIR/html_util.sh
. $DIAGDIR/conf_util.sh
export DIAGDIR
echo $DIAGDIR
DEV=pdf
RUNID=srtm30_403_1982-1987
CTLID=control_403_1982-1987
FFMT=grd
# switches
LERA15PS=1
LERA15CE=1
LPRCP=1
LLW=1
LNCEPCE=1
LNCEPPS=1
LNCEPVEC=.
LERBE=1
LISCCPFD=1
LCLDAMT=1
LHADISST=0
LYZ=1
LTY=1
LTR=1
LWEB=1
# define dset id
PRCPIDS="XIEARKIN GPCP TRMM"
# define plot id
ERA15PSIDS="Z500 U50"
ERA15CEIDS="TTRP EVAP T850 T200 Z500 Z300 U200"
LWIDS="T2"
#NCEPCEIDS="SFCG SENS SLP"
#NCEPCEIDS="SENS SLP"
NCEPCEIDS="SLP"
NCEPVECIDS="TAUXY UV10"
ERBEIDS="OSR OLR RT RTFS"
ISCCPFDIDS="SSRD SLRD SSR SLR FS"
YZIDS="UYZ TYZ QYZ OMGYZ"
TYIDS="U200 V200"
# define paths
RUNDIR=/Volumes/Quadra2/amip/clim/$RUNID/mean
GEORUN=/Users/eno/afes/data/geo/T119/f4
CTLDIR=/Volumes/Quadra2/amip/clim/$CTLID/mean
GEOCTL=/Users/eno/afes/data/geo/T119/f4
OBSDIR=/Users/eno/research/obs_data
WEBDIR=/Users/eno/research/amip/$RUNID/web
PDFDIR=/Users/eno/research/amip/$RUNID/pdf
NCARG_ROOT=/opt/local
CONVERT="/opt/local/bin/convert -trim -density 128x128"
# --- do not edit below
export NCARG_ROOT
NCL=$NCARG_ROOT/bin/ncl
PLOTXY=$DIAGDIR/plot_xy.ncl
PLOTYZ=$DIAGDIR/plot_yz.ncl
PLOTTY=$DIAGDIR/plot_ty.ncl
PLOTTR=$DIAGDIR/plot_tr.ncl
# define season id
ANN=0
MAM=1
JJA=2
SON=3
DJF=4
MON=5
LSEASONAL=True
# implied heat transports
if [[ $LTR -eq 1 ]]; then
DSET=ANNUAL_TRANSPORTS_1985_1989
echo $DSET
TIME=$ANN
PLOTID=HT
echo $PLOTID
makeconf
$NCL $PLOTTR
fi
# pressure surface plots
# ERA polar
if [[ $LERA15PS -eq 1 ]]; then
DSET=ECMWF
echo $DSET $ERA15PSIDS
for PLID in $ERA15PSIDS; do
echo $PLID
for TIME in $ANN $JJA $DJF; do
PLOTID=${PLID}NH
makeconf
setpolar NH 20 90
$NCL $PLOTXY > /dev/null
PLOTID=${PLID}SH
makeconf
setpolar SH -90 -20
$NCL $PLOTXY > /dev/null
done
done
fi
# ERA lat-lon
if [[ $LERA15CE -eq 1 ]]; then
DSET=ECMWF
echo $DSET $ERA15CEIDS
for PLOTID in $ERA15CEIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
if [[ $PLOTID == "TTRP" ]]; then
settrop
setmin
fi
$NCL $PLOTXY > /dev/null
done
done
fi
# Legates & Willmott
if [[ $LLW -eq 1 ]]; then
DSET=LEGATES
echo $DSET $LWIDS
for PLOTID in $LWIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# NCEP lat-lon
if [[ $LNCEPCE -eq 1 ]]; then
DSET=NCEP
echo $DSET
for PLOTID in $NCEPCEIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# NCEP vector lat-lon
if [[ $LNCEPVEC -eq 1 ]]; then
DSET=NCEP
echo $DSET
for PLOTID in $NCEPVECIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
setvec
$NCL $PLOTXY > /dev/null
done
done
fi
# NCEP SLP polar
if [[ $LNCEPPS -eq 1 ]]; then
DSET=NCEP
echo $DSET SLP
for TIME in $ANN $JJA $DJF; do
PLOTID=SLPNH
makeconf
setpolar NH 20 90
$NCL $PLOTXY > /dev/null
PLOTID=SLPSH
makeconf
setpolar SH -90 -20
$NCL $PLOTXY > /dev/null
done
fi
# PRCP lat-lon
if [[ $LPRCP -eq 1 ]]; then
for DSET in $PRCPIDS; do
PLOTID=PRCP_$DSET
echo $DSET
for TIME in $ANN $JJA $DJF; do
makeconf
if [[ $DSET == "TRMM" ]]; then
settrop
fi
$NCL $PLOTXY > /dev/null
done
done
fi
# ERBE lat-lon
if [[ $LERBE -eq 1 ]]; then
DSET=ERBE
echo $DSET
for PLOTID in $ERBEIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# ISCCP FD
if [[ $LISCCPFD -eq 1 ]]; then
DSET=ISCCPFD
echo $DSET
for PLOTID in $ISCCPFDIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# CLDAMT
if [[ $LCLDAMT -eq 1 ]]; then
DSET=ISCCP
echo $DSET
for PLOTID in CCOVER; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# HadISST
if [[ $LHADISST -eq 1 ]]; then
DSET=HadISST
echo $DSET
for PLOTID in SST; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTXY > /dev/null
done
done
fi
# ERA lat-pres
if [[ $LYZ -eq 1 ]]; then
DSET=ECMWF
echo $DSET $YZIDS
for PLOTID in $YZIDS; do
echo $PLOTID
for TIME in $ANN $JJA $DJF; do
makeconf
$NCL $PLOTYZ > /dev/null
done
done
fi
if [[ $LTY -eq 1 ]]; then
LSEASONAL=False
DSET=ECMWF
echo $DSET $TYIDS
for PLOTID in $TYIDS; do
echo $PLOTID
makeconf
$NCL $PLOTTY > /dev/null
done
# GPCP
DSET=GPCP
PLOTID=PRCP
echo $DSET PRCP
makeconf
$NCL $PLOTTY > /dev/null
fi
#
# HTML
#
if [[ $LWEB -eq 1 ]]; then
if [[ ! -d $WEBDIR ]]; then
mkdir $WEBDIR
fi
if [[ ! -d $PDFDIR ]]; then
mkdir $PDFDIR
fi
# create HTML
export HTML="$WEBDIR/index.html"
html_header $RUNID
html_dataset "GPCP 1979-2002"
html_row_begin PRCP
html_entry "${RUNID}_PRCP_GPCP_DJF.png" DJF
html_entry "${RUNID}_PRCP_GPCP_JJA.png" JJA
html_entry "${RUNID}_PRCP_GPCP_ANN.png" ANN
html_row_end
html_dataset "CMAP (Xie and Arkin) 1979-1998"
html_row_begin PRCP
html_entry "${RUNID}_PRCP_XIEARKIN_DJF.png" DJF
html_entry "${RUNID}_PRCP_XIEARKIN_JJA.png" JJA
html_entry "${RUNID}_PRCP_XIEARKIN_ANN.png" ANN
html_row_end
html_dataset "TRMM (3B-43) Jan 1998-Aug 2003"
html_row_begin PRCP
html_entry "${RUNID}_PRCP_TRMM_DJF.png" DJF
html_entry "${RUNID}_PRCP_TRMM_JJA.png" JJA
html_entry "${RUNID}_PRCP_TRMM_ANN.png" ANN
html_dataset "Legates & Willmott 1920-80"
for PLOTID in $LWIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "NCEP 1979-98"
for HM in NH SH; do
html_row_begin SLP${HM}
html_entry "${RUNID}_SLP${HM}_DJF.png" DJF
html_entry "${RUNID}_SLP${HM}_JJA.png" JJA
html_entry "${RUNID}_SLP${HM}_ANN.png" ANN
html_row_end
done
for PLOTID in $NCEPCEIDS $NCEPVECIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "ERA 1979-93 polar"
for PLOTID in $ERA15PSIDS; do
for HM in NH SH; do
html_row_begin ${PLOTID}${HM}
html_entry "${RUNID}_${PLOTID}${HM}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}${HM}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}${HM}_ANN.png" ANN
html_row_end
done
done
html_dataset "ERA 1979-93 lat-lon"
for PLOTID in $ERA15CEIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "ERBE Feb1985-Apr1989 lat-lon"
for PLOTID in $ERBEIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "ISCCP FD Jul1983-Dec2000"
for PLOTID in $ISCCPFDIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "ISCCP D2 Jul 1983-Sep 2001"
for PLOTID in CCOVER; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
# html_dataset "HadISST/OI.v2 1982-2001"
# for PLOTID in SST; do
# html_row_begin ${PLOTID}
# html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
# html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
# html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
# html_row_end
# done
html_dataset "ERA 1979-93 lat-pres"
for PLOTID in $YZIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_DJF.png" DJF
html_entry "${RUNID}_${PLOTID}_JJA.png" JJA
html_entry "${RUNID}_${PLOTID}_ANN.png" ANN
html_row_end
done
html_dataset "ERA 1979-93 time-lat"
for PLOTID in $TYIDS; do
html_row_begin ${PLOTID}
html_entry "${RUNID}_${PLOTID}_ANC.png" ANC
html_row_end
done
html_dataset "GPCP 1979-2002 time-lat"
html_row_begin PRCP
html_entry "${RUNID}_PRCP_ANC.png" ANC
html_row_end
html_dataset "NCEP derived heat transport"
html_row_begin "HT"
html_entry "${RUNID}_OHT_ANN.png" OHT
html_entry "${RUNID}_AHT_ANN.png" AHT
html_row_end
html_footer
# convert
for ITEM in `ls *.pdf`; do
echo converting $ITEM to $WEBDIR/${ITEM%pdf}png
$CONVERT $ITEM $WEBDIR/${ITEM%pdf}png
done
mv -f *.pdf $PDFDIR/
fi