-
Notifications
You must be signed in to change notification settings - Fork 2
/
gdplot2.csh
executable file
·120 lines (100 loc) · 2.75 KB
/
gdplot2.csh
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
#!/bin/csh -f
# Source Gemenviron
source /home/gempak/NAWIPS/Gemenviron
set TopLevelDir=~/unidata-gempak-workshop
cd $TopLevelDir
# Set display so we can use the _gf programs
setenv DISPLAY :0.0
# Take first input argument for cycle
if ( $#argv > 0 ) then
set CYCLE=$1
else
set CYCLE=`date -u '+%Y%m%d%H'`
endif
# Create YYYYMMDD/HHMMf000 GEMPAK GDATTIM string parts
set CycleHr=`echo $CYCLE | cut -c 9-`
set CycleDay=`echo $CYCLE | cut -c -8`
# Take model name and nts file arguments
set ModelName=$3
switch ($ModelName)
case [Hh][Rr][Rr][Rr]:
set inc=1
breaksw
case wrf
set ModelName="wrf:primary.gem"
set inc=1
breaksw
default:
set inc=3
endsw
set nts=$4
set split = ($nts:as/./ /)
set parm = $split[1]
# Set local table directory for custom colors
switch ($parm)
case tmpf:
set colors='27=38:38:38;28=122:122:122'
setenv NCDESK $TopLevelDir/tables/
breaksw
default:
set colors=""
unsetenv NCDESK
endsw
echo $parm
# Set GIF name and create directories
set AnimationName=${ModelName}_${parm}
if ( -e ${AnimationName} ) rm -rf ${AnimationName}
if ( ! -e ${AnimationName} ) mkdir ${AnimationName}
cd ${AnimationName}
if ( ! -e ${CYCLE} ) mkdir ${CYCLE}
cd $CYCLE
# Increment over forecast hours
@ HourCount = 0
while ( $HourCount <= $2 )
# Account for three digit filenames
if ( $HourCount < 10 ) then
set ForecastHour=00${HourCount}
set GifName=${ModelName}_f0${HourCount}_${parm}.gif
else
set ForecastHour=0${HourCount}
set GifName=${ModelName}_f${HourCount}_${parm}.gif
endif
# run GDPLOT2_GF
gdplot2_gf << EOF_GIF
DEVICE = xw
DEVICE = gf|${GifName}|900;675
GDFILE = ${ModelName}
GDATTIM = ${CycleDay}/${CycleHr}00f${ForecastHour}
TITLE = 31/-2/${ModelName} ? ~ @ _ ! 31/-1/ @ _ ! 0
\$mapfil = hicnus.nws + histus.nws + hiisus.nws + hiuhus.nws
\$mapfil = base
MAP = 30/1+8/1/1+31/1/2 +28
MAP = 31/1/1 + 31/1/2 + 28
PROJ = def
COLORS = ${colors}
GAREA = dset
restore ${TopLevelDir}/${nts}
l
r
e
EOF_GIF
@ HourCount = $HourCount + ${inc}
end
set GifFileList=`ls *_${parm}.gif`
echo $GifFileList
if ($#GifFileList < 1 ) then
echo "No current gif files found"
exit
endif
#
# things to loop
set FirstFileName=$GifFileList[1]
shift GifFileList
set NUM=$#GifFileList
set LastFileName=$GifFileList[$NUM]
set GifFileList[$NUM]=""
convert -loop 0 -delay 100 $FirstFileName -delay 10 $GifFileList -delay 200 $LastFileName ${ModelName}_latest_${parm}_anim.gif
scp -Bq ${ModelName}_latest_${parm}_anim.gif conan:/content/software/gempak/rtmodel/
scp -Bq ${ModelName}_latest_${parm}_anim.gif conan:/content/software/gempak/rtmodel/${CYCLE}/${ModelName}_${CYCLE}_${parm}_anim.gif
scp -Bq ${ModelName}_f00_${parm}.gif conan:/content/software/gempak/rtmodel/
scp -Bq ${ModelName}_f03_${parm}.gif conan:/content/software/gempak/rtmodel/