-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathexgdas_atmos_nawips.sh
executable file
·165 lines (142 loc) · 3.7 KB
/
exgdas_atmos_nawips.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
#! /usr/bin/env bash
###################################################################
# echo "----------------------------------------------------"
# echo "exnawips - convert NCEP GRIB files into GEMPAK Grids"
# echo "----------------------------------------------------"
# echo "History: Mar 2000 - First implementation of this new script."
# echo "S Lilly: May 2008 - add logic to make sure that all of the "
# echo " data produced from the restricted ECMWF"
# echo " data on the CCS is properly protected."
#####################################################################
source "$HOMEgfs/ush/preamble.sh" "${2}"
cd $DATA
RUN2=$1
fend=$2
DBN_ALERT_TYPE=$3
DATA_RUN=$DATA/$RUN2
mkdir -p $DATA_RUN
cd $DATA_RUN
cp $FIXgempak/g2varswmo2.tbl g2varswmo2.tbl
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File g2varswmo2.tbl file is missing."
exit $err
fi
cp $FIXgempak/g2vcrdwmo2.tbl g2vcrdwmo2.tbl
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File g2vcrdwmo2.tbl file is missing."
exit $err
fi
cp $FIXgempak/g2varsncep1.tbl g2varsncep1.tbl
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File g2varsncep1.tbl file is missing."
exit $err
fi
cp $FIXgempak/g2vcrdncep1.tbl g2vcrdncep1.tbl
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File g2vcrdncep1.tbl file is missing."
exit $err
fi
#
NAGRIB=$GEMEXE/nagrib2_nc
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File $GEMEXE/nagrib2_nc is missing."
echo " WARNING: module GEMPAK was not loaded"
exit $err
fi
cpyfil=gds
garea=dset
gbtbls=
maxgrd=4999
kxky=
grdarea=
proj=
output=T
pdsext=no
maxtries=180
fhcnt=$fstart
while [ $fhcnt -le $fend ] ; do
fhr=$(printf "%03d" $fhcnt)
fhcnt3=$(expr $fhr % 3)
fhr3=$(printf "%03d" $fhcnt)
GEMGRD=${RUN2}_${PDY}${cyc}f${fhr3}
if [ $RUN2 = "gdas_0p25" ]; then
export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr}
if [ ! -f $GRIBIN ] ; then
echo "WARNING: $GRIBIN FILE is missing"
fi
GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr}.idx
else
export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr}
if [ ! -f $GRIBIN ] ; then
echo "WARNING: $GRIBIN FILE is missing"
fi
GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr}.idx
fi
icnt=1
while [ $icnt -lt 1000 ]
do
if [ -r $GRIBIN_chk ] ; then
sleep 5
break
else
echo "The process is waiting ... ${GRIBIN_chk} file to proceed."
sleep 20
let "icnt=icnt+1"
fi
if [ $icnt -ge $maxtries ]
then
echo "ABORTING: after 1 hour of waiting for ${GRIBIN_chk} file at F$fhr to end."
export err=7 ; err_chk
exit $err
fi
done
cp $GRIBIN grib$fhr
export pgm="nagrib2 F$fhr"
startmsg
$NAGRIB << EOF
GBFILE = grib$fhr
INDXFL =
GDOUTF = $GEMGRD
PROJ = $proj
GRDAREA = $grdarea
KXKY = $kxky
MAXGRD = $maxgrd
CPYFIL = $cpyfil
GAREA = $garea
OUTPUT = $output
GBTBLS = $gbtbls
GBDIAG =
PDSEXT = $pdsext
l
r
EOF
export err=$?;err_chk
if [ $SENDCOM = "YES" ] ; then
cp $GEMGRD $COMOUT/.$GEMGRD
export err=$?
if [[ $err -ne 0 ]] ; then
echo " File $GEMGRD does not exist."
exit $err
fi
mv $COMOUT/.$GEMGRD $COMOUT/$GEMGRD
if [ $SENDDBN = "YES" ] ; then
$DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job \
$COMOUT/$GEMGRD
else
echo "##### DBN_ALERT_TYPE is: ${DBN_ALERT_TYPE} #####"
fi
fi
if [ $fhcnt -ge 240 ] ; then
let fhcnt=fhcnt+12
else
let fhcnt=fhcnt+finc
fi
done
$GEMEXE/gpend
#####################################################################
############################### END OF SCRIPT #######################