1 | #!/bin/ksh
|
---|
2 |
|
---|
3 | echo "Running $TEST on $COMPILER_NAME"
|
---|
4 |
|
---|
5 | # Set up environment variables
|
---|
6 | export ROPP_ROOT=$DIRECTORY/ropp_deps
|
---|
7 | export BUFR_LIBRARY=$ROPP_ROOT/data/bufr/
|
---|
8 | export BUFR_TABLES=$ROPP_ROOT/data/bufr/
|
---|
9 |
|
---|
10 | # Location of executables (must already be compiled)
|
---|
11 | export BIN_DIR=$ROPP_ROOT/$COMPILER_NAME/bin
|
---|
12 |
|
---|
13 | # Create temporary directory for output data
|
---|
14 | export TMP_DIR=$DIRECTORY/ropp_test_tmp_$TEST
|
---|
15 | mkdir -p $TMP_DIR
|
---|
16 | cd $TMP_DIR
|
---|
17 |
|
---|
18 | # Define source directories for both local and HPC runs
|
---|
19 | if [ $COMPILER_NAME = ifort ] ; then
|
---|
20 | export DATA_SOURCE1=${SPICE_SRV}:$DATA_SOURCE # test data
|
---|
21 | export DATA_SOURCE2=$DIRECTORY/ropp_io/data # thinning files
|
---|
22 | else
|
---|
23 | export DATA_SOURCE1=$DATA_SOURCE # test data
|
---|
24 | export DATA_SOURCE2=$DIRECTORY/ropp_io/data # thinning files
|
---|
25 | fi
|
---|
26 |
|
---|
27 | # Accumulate any errors with this variable
|
---|
28 | error_code=0
|
---|
29 |
|
---|
30 | # IO options
|
---|
31 | set -A options 'lin-247' 'sglin-247' 'sglog-247' 'asglog-247'
|
---|
32 | n_opts=${#options[*]}
|
---|
33 |
|
---|
34 | case $TEST in
|
---|
35 |
|
---|
36 | io_01 )
|
---|
37 | filet=MT-IO-01.1.nc
|
---|
38 |
|
---|
39 | echo "$BIN_DIR/test2ropp MISSING -n 100 -o ${filet}_MISSING"
|
---|
40 | $BIN_DIR/test2ropp MISSING -n 100 -o ${filet}_MISSING
|
---|
41 | RC=$? ; echo "Return code = $RC" ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
42 |
|
---|
43 | echo "$BIN_DIR/ropp2ropp -u ${filet}_MISSING -o $(echo $filet |sed -es/'1.nc'/'2.nc'/)"
|
---|
44 | $BIN_DIR/ropp2ropp -u ${filet}_MISSING -o $(echo $filet |sed -es/'1.nc'/'2.nc'/)
|
---|
45 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
46 |
|
---|
47 | echo "$BIN_DIR/test2ropp INVALID -n 100 -o ${filet}_INVALID"
|
---|
48 | $BIN_DIR/test2ropp INVALID -n 100 -o ${filet}_INVALID
|
---|
49 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
50 |
|
---|
51 | echo "$BIN_DIR/ropp2ropp -u ${filet}_INVALID -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)"
|
---|
52 | $BIN_DIR/ropp2ropp -u ${filet}_INVALID -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)
|
---|
53 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
54 | # Compare MT-IO-01.2.nc and MT-IO-01.3.nc
|
---|
55 |
|
---|
56 | echo "$BIN_DIR/test2ropp VALID -n 100 -o ${filet}"
|
---|
57 | $BIN_DIR/test2ropp VALID -n 100 -o ${filet}
|
---|
58 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
59 |
|
---|
60 | echo "$BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'2.nc'/)"
|
---|
61 | $BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'2.nc'/)
|
---|
62 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
63 | # Compare MT-IO-01.1.nc and MT-IO-01.2.nc
|
---|
64 |
|
---|
65 | echo "$BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'5.nc'/)"
|
---|
66 | $BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'5.nc'/)
|
---|
67 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
68 |
|
---|
69 | echo "$BIN_DIR/ropp2bufr -u $(echo $filet |sed -es/'1.nc'/'5.nc'/) -o $(echo $filet |sed -es/'1.nc'/'1.bufr'/)"
|
---|
70 | $BIN_DIR/ropp2bufr -u $(echo $filet |sed -es/'1.nc'/'5.nc'/) -o $(echo $filet |sed -es/'1.nc'/'1.bufr'/)
|
---|
71 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
72 |
|
---|
73 | echo "$BIN_DIR/bufr2ropp -u $(echo $filet |sed -es/'1.nc'/'1.bufr'/) -o $(echo $filet |sed -es/'1.nc'/'4.nc'/)"
|
---|
74 | $BIN_DIR/bufr2ropp -u $(echo $filet |sed -es/'1.nc'/'1.bufr'/) -o $(echo $filet |sed -es/'1.nc'/'4.nc'/)
|
---|
75 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
76 |
|
---|
77 | echo "$BIN_DIR/ropp2bufr -u $(echo $filet |sed -es/'1.nc'/'4.nc'/) -o $(echo $filet |sed -es/'1.nc'/'1.bufr'/)"
|
---|
78 | $BIN_DIR/ropp2bufr -u $(echo $filet |sed -es/'1.nc'/'4.nc'/) -o $(echo $filet |sed -es/'1.nc'/'1.bufr'/)
|
---|
79 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
80 |
|
---|
81 | echo "$BIN_DIR/bufr2ropp -u $(echo $filet |sed -es/'1.nc'/'1.bufr'/) -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)"
|
---|
82 | $BIN_DIR/bufr2ropp -u $(echo $filet |sed -es/'1.nc'/'1.bufr'/) -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)
|
---|
83 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
84 | # Compare MT-IO-01.4.nc and MT-IO-01.3.nc
|
---|
85 |
|
---|
86 | testf=MT-IO-01.nc
|
---|
87 | echo "scp $DATA_SOURCE1/$testf $TMP_DIR/$filet"
|
---|
88 | scp $DATA_SOURCE1/$testf $TMP_DIR/$filet
|
---|
89 |
|
---|
90 | echo "$BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)"
|
---|
91 | $BIN_DIR/ropp2ropp -u ${filet} -o $(echo $filet |sed -es/'1.nc'/'3.nc'/)
|
---|
92 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
93 | # Compare MT-IO-01.1.nc and MT-IO-01.3.nc
|
---|
94 |
|
---|
95 | echo " Error code after running $TEST = $error_code"
|
---|
96 | ;;
|
---|
97 |
|
---|
98 | io_02 )
|
---|
99 | filet=MT-IO-02.nc
|
---|
100 | filet1=MT-IO-02.3.nc
|
---|
101 | filet2=MT-IO-02.4.nc
|
---|
102 | echo "scp $DATA_SOURCE1/$filet $TMP_DIR/$filet1"
|
---|
103 | scp $DATA_SOURCE1/$filet $TMP_DIR/$filet1
|
---|
104 |
|
---|
105 | # Manually alter some variables with units of metres to km
|
---|
106 | set -A vars undulation roc phase_L1 impact alt_refrac tph_bangle pblh_refrac
|
---|
107 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
108 | var=${vars[$(($i - 1))]}
|
---|
109 | echo "Manually adjusting $var in $filet1"
|
---|
110 | ncatted -a 'units',${var},o,c,'km' $filet1
|
---|
111 | ncap2 -s"${var}/=1000.0; ${var}@valid_range/=1000.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
112 | mv temp.nc $filet1
|
---|
113 | done
|
---|
114 | # Manually alter some variables with units of metres to km
|
---|
115 | set -A vars r_coc r_leo_ref r_gns
|
---|
116 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
117 | var=${vars[$(($i - 1))]}
|
---|
118 | echo "Manually adjusting $var in $filet1"
|
---|
119 | ncatted -a 'units',${var},o,c,'km' $filet1
|
---|
120 | ncap2 -s"${var}/=1000.0; ${var}@valid_range/=1000.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name; ${var}@reference_frame=${var}@reference_frame" $filet1 -O temp.nc
|
---|
121 | mv temp.nc $filet1
|
---|
122 | done
|
---|
123 | # Manually alter some variables with units of geopotential metres to gpkm
|
---|
124 | set -A vars geop tph_temp_lrt pblh_temp
|
---|
125 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
126 | var=${vars[$(($i - 1))]}
|
---|
127 | echo "Manually adjusting $var in $filet1"
|
---|
128 | ncatted -a 'units',${var},o,c,'gpkm' $filet1
|
---|
129 | ncap2 -s"${var}/=1000.0; ${var}@valid_range/=1000.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
130 | mv temp.nc $filet1
|
---|
131 | done
|
---|
132 | # Manually alter some variables with units of degrees_east to degrees_west
|
---|
133 | set -A vars lon lon_tp
|
---|
134 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
135 | var=${vars[$(($i - 1))]}
|
---|
136 | echo "Manually adjusting $var in $filet1"
|
---|
137 | ncatted -a 'units',${var},o,c,'degrees_west' $filet1
|
---|
138 | ncap2 -s"${var}/=-1.0; ${var}@valid_range/=-1.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
139 | mv temp.nc $filet1
|
---|
140 | done
|
---|
141 | # Manually alter some variables with units of degrees_north, degrees_T or degrees to radians
|
---|
142 | set -A vars lat azimuth lat_tp azimuth_tp
|
---|
143 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
144 | var=${vars[$(($i - 1))]}
|
---|
145 | echo "Manually adjusting $var in $filet1"
|
---|
146 | ncatted -a 'units',${var},o,c,'radians' $filet1
|
---|
147 | ncap2 -s"${var}/=(180.0d/3.141592653589793238d); ${var}@valid_range/=(180.0d/3.141592653589793238d); ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
148 | mv temp.nc $filet1
|
---|
149 | done
|
---|
150 | # Manually alter some variables with units of hPa to pascals
|
---|
151 | set -A vars press level_coeff_a
|
---|
152 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
153 | var=${vars[$(($i - 1))]}
|
---|
154 | echo "Manually adjusting $var in $filet1"
|
---|
155 | ncatted -a 'units',${var},o,c,'pascals' $filet1
|
---|
156 | ncap2 -s"${var}*=100.0; ${var}@valid_range*=100.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
157 | mv temp.nc $filet1
|
---|
158 | done
|
---|
159 | # Manually alter some variables with units of kelvin to degC
|
---|
160 | set -A vars dry_temp temp tpt_tdry_lrt pblt_tdry
|
---|
161 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
162 | var=${vars[$(($i - 1))]}
|
---|
163 | echo "Manually adjusting $var in $filet1"
|
---|
164 | ncatted -a 'units',${var},o,c,'degC' $filet1
|
---|
165 | ncap2 -s"${var}-=273.15; ${var}@valid_range-=273.15; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
166 | mv temp.nc $filet1
|
---|
167 | done
|
---|
168 | # Manually alter some variables with units of gram / kilogram to gram / gram
|
---|
169 | set -A vars shum pblq_shum
|
---|
170 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
171 | var=${vars[$(($i - 1))]}
|
---|
172 | echo "Manually adjusting $var in $filet1"
|
---|
173 | ncatted -a 'units',${var},o,c,'gram / gram' $filet1
|
---|
174 | ncap2 -s"${var}/=1000.0; ${var}@valid_range/=1000.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
175 | mv temp.nc $filet1
|
---|
176 | done
|
---|
177 | # Manually alter some variables with units of metres / seconds to km / hour
|
---|
178 | set -A vars v_leo_ref v_gns
|
---|
179 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
180 | var=${vars[$(($i - 1))]}
|
---|
181 | echo "Manually adjusting $var in $filet1"
|
---|
182 | ncatted -a 'units',${var},o,c,'km / hour' $filet1
|
---|
183 | ncap2 -s"${var}*=3.6; ${var}@valid_range*=3.6; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name; ${var}@reference_frame=${var}@reference_frame" $filet1 -O temp.nc
|
---|
184 | mv temp.nc $filet1
|
---|
185 | done
|
---|
186 | # Manually alter some variables with units of hours to seconds
|
---|
187 | set -A vars hour
|
---|
188 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
189 | var=${vars[$(($i - 1))]}
|
---|
190 | echo "Manually adjusting $var in $filet1"
|
---|
191 | ncatted -a 'units',${var},o,c,'seconds' $filet1
|
---|
192 | ncap2 -s"${var}*=3600.0; ${var}@valid_range*=3600.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
193 | mv temp.nc $filet1
|
---|
194 | done
|
---|
195 | # Manually alter some variables with units of minutes to seconds
|
---|
196 | set -A vars minute
|
---|
197 | for i in $(seq 1 ${#vars[*]}) ; do
|
---|
198 | var=${vars[$(($i - 1))]}
|
---|
199 | echo "Manually adjusting $var in $filet1"
|
---|
200 | ncatted -a 'units',${var},o,c,'seconds' $filet1
|
---|
201 | ncap2 -s"${var}*=60.0; ${var}@valid_range*=60.0; ${var}@units=${var}@units; ${var}@long_name=${var}@long_name" $filet1 -O temp.nc
|
---|
202 | mv temp.nc $filet1
|
---|
203 | done
|
---|
204 |
|
---|
205 | echo "$BIN_DIR/ropp2ropp -d -u -m ${filet1} -o ${filet2}"
|
---|
206 | $BIN_DIR/ropp2ropp -d -u -m ${filet1} -o ${filet2}
|
---|
207 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
208 | # Compare MT-IO-02.nc and MT-IO-02.4.nc
|
---|
209 |
|
---|
210 | echo " Error code after running $TEST = $error_code"
|
---|
211 | ;;
|
---|
212 |
|
---|
213 | io_03 )
|
---|
214 | exec=$BIN_DIR/ropp2ropp
|
---|
215 | ifile=MT-IO-03.nc
|
---|
216 | echo "scp $DATA_SOURCE1/$ifile $TMP_DIR"
|
---|
217 | scp $DATA_SOURCE1/$ifile $TMP_DIR
|
---|
218 |
|
---|
219 | for i in $(seq 1 $n_opts) ; do
|
---|
220 | opt=${options[$(($i - 1))]}
|
---|
221 | echo " Thinning option ${i}: ${opt}"
|
---|
222 | ofile=$(echo $ifile | sed -es/".nc"/".${i}.nc"/)
|
---|
223 | thin_file=ropp_thin_${opt}.dat
|
---|
224 | echo "scp $DATA_SOURCE2/$thin_file $TMP_DIR"
|
---|
225 | scp $DATA_SOURCE2/$thin_file $TMP_DIR
|
---|
226 |
|
---|
227 | echo "$exec $ifile -p $thin_file -m -a -o $ofile"
|
---|
228 | $exec $ifile -p $thin_file -m -a -o $ofile
|
---|
229 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
230 | done
|
---|
231 |
|
---|
232 | echo " Error code after running $TEST = $error_code"
|
---|
233 | ;;
|
---|
234 |
|
---|
235 | io_04 )
|
---|
236 | exec=$BIN_DIR/ucar2ropp
|
---|
237 | ifile=MT-IO-04.nc
|
---|
238 | ofile=MT-IO-04.1.nc
|
---|
239 | echo "scp $DATA_SOURCE1/$ifile $TMP_DIR"
|
---|
240 | scp $DATA_SOURCE1/$ifile $TMP_DIR
|
---|
241 |
|
---|
242 | echo "$exec $ifile -d -o $ofile"
|
---|
243 | $exec $ifile -d -o $ofile
|
---|
244 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
245 |
|
---|
246 | echo " Error code after running $TEST = $error_code"
|
---|
247 | ;;
|
---|
248 |
|
---|
249 | io_05 )
|
---|
250 | exec=$BIN_DIR/gfz2ropp
|
---|
251 |
|
---|
252 | idir=MT-IO-05/NRT
|
---|
253 | echo "scp $DATA_SOURCE1/$idir/*.dat $TMP_DIR"
|
---|
254 | scp $DATA_SOURCE1/$idir/*.dat $TMP_DIR
|
---|
255 | echo "scp $DATA_SOURCE1/$idir/*.dsc $TMP_DIR"
|
---|
256 | scp $DATA_SOURCE1/$idir/*.dsc $TMP_DIR
|
---|
257 |
|
---|
258 | for ifile in $(ls ??-AI-*.dat) ; do
|
---|
259 | echo "Processing $ifile"
|
---|
260 | ofile=$(echo $ifile |sed -es/'.dat'/'.nc'/)
|
---|
261 |
|
---|
262 | echo "$exec $ifile -o $ofile"
|
---|
263 | $exec $ifile -o $ofile
|
---|
264 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
265 | done
|
---|
266 | echo " Error code after running $TEST = $error_code"
|
---|
267 |
|
---|
268 | idir=MT-IO-05/PD
|
---|
269 | echo "scp $DATA_SOURCE1/$idir/*.dat $TMP_DIR"
|
---|
270 | scp $DATA_SOURCE1/$idir/*.dat $TMP_DIR
|
---|
271 | echo "scp $DATA_SOURCE1/$idir/*.dsc $TMP_DIR"
|
---|
272 | scp $DATA_SOURCE1/$idir/*.dsc $TMP_DIR
|
---|
273 |
|
---|
274 | for ifile in $(ls ??-AI-*.dat) ; do
|
---|
275 | echo "Processing $ifile"
|
---|
276 | ofile=$(echo $ifile |sed -es/'.dat'/'.nc'/)
|
---|
277 |
|
---|
278 | echo "$exec $ifile -o $ofile"
|
---|
279 | $exec $ifile -o $ofile
|
---|
280 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
281 | done
|
---|
282 |
|
---|
283 | echo " Error code after running $TEST = $error_code"
|
---|
284 | ;;
|
---|
285 |
|
---|
286 | io_op )
|
---|
287 | exec=$BIN_DIR/ropp2ropp
|
---|
288 | ifile=MT-IO-OP.nc
|
---|
289 | echo "scp $DATA_SOURCE1/$ifile $TMP_DIR"
|
---|
290 | scp $DATA_SOURCE1/$ifile $TMP_DIR
|
---|
291 |
|
---|
292 | for i in $(seq 1 $n_opts) ; do
|
---|
293 | opt=${options[$(($i - 1))]}
|
---|
294 | echo " Thinning option ${i}: ${opt}"
|
---|
295 | ofile=$(echo $ifile | sed -es/".nc"/".${i}.nc"/)
|
---|
296 | thin_file=ropp_thin_${opt}.dat
|
---|
297 | echo "scp $DATA_SOURCE2/$thin_file $TMP_DIR"
|
---|
298 | scp $DATA_SOURCE2/$thin_file $TMP_DIR
|
---|
299 |
|
---|
300 | echo "$exec $ifile -p $thin_file -m -a -o $ofile"
|
---|
301 | $exec $ifile -p $thin_file -m -a -o $ofile
|
---|
302 | RC=$? ; echo "Return code = $RC" ; if [ $RC -gt 1 ] ; then ; error_code=$(($error_code+$RC)) ; fi
|
---|
303 | done
|
---|
304 |
|
---|
305 | echo " Error code after running $TEST = $error_code"
|
---|
306 | ;;
|
---|
307 |
|
---|
308 | esac
|
---|
309 |
|
---|
310 |
|
---|
311 | if [ $error_code -gt 0 ]
|
---|
312 | then echo "Errors encountered"
|
---|
313 | exit $error_code
|
---|
314 | else
|
---|
315 | exit 0
|
---|
316 | fi
|
---|