Vertstat.test.in 881 Bytes
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
#! @BASH@
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2
echo 1..11 # Number of tests to be executed.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
3
4
5
6
7
8
9
10
11
#
test -n "$CDO"      || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
CDOOUT=cout$$
CDOERR=cerr$$
FORMAT="-f srv -b 32"
#
TYPE=vert
Uwe Schulzweida's avatar
Uwe Schulzweida committed
12
STATS="min max range sum avg mean std std1 var var1 int"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
#
IFILE=$DATAPATH/pl_data.grb
#
NTEST=1
#
for STAT in $STATS; do
  RSTAT=0
  RFILE=$DATAPATH/${TYPE}${STAT}_ref
  OFILE=${TYPE}${STAT}_res

  CDOTEST="${TYPE}$STAT"
  CDOCOMMAND="$CDO $FORMAT ${TYPE}${STAT} $IFILE $OFILE"

  echo "Running test: $NTEST"
  echo "$CDOCOMMAND"

  $CDOCOMMAND
  test $? -eq 0 || let RSTAT+=1

  $CDO diff $OFILE $RFILE > $CDOOUT 2> $CDOERR
  test $? -eq 0 || let RSTAT+=1
  test -s $CDOOUT && let RSTAT+=1
  cat $CDOOUT $CDOERR

  test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
  test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"

  let NTEST+=1
  rm -f $OFILE
done
#
rm -f $CDOOUT $CDOERR
#
exit 0