Collgrid.test.in 1.25 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
#! @BASH@
2
echo 1..9 # Number of tests to be executed.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
3
4
5
6
#
test -n "$CDO"      || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
7
8
CDOOUT=cout$$
CDOERR=cerr$$
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
#
10
GRIDTYPES="regular generic curvilinear"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
11
12
13
14
DISTS="4,3 12,1 1,6"
#
NTEST=1
#
15
for GRIDTYPE in $GRIDTYPES; do
Uwe Schulzweida's avatar
Uwe Schulzweida committed
16
17
  for DIST in $DISTS; do
    RSTAT=0
18
19
    GT=$(echo $GRIDTYPE | cut -c1)
    FILE=data${GT}.nc
Uwe Schulzweida's avatar
Uwe Schulzweida committed
20
21
22
    IFILE=$DATAPATH/${FILE}
    OFILE=${OPERATOR}_${FILE}

23
    CDOTEST="$GRIDTYPE $DIST"
Uwe Schulzweida's avatar
Uwe Schulzweida committed
24
25
26
27

    if [ "@ENABLE_NETCDF@" = yes ] ; then
      nx=$(echo $DIST | sed 's/,.*//')
      NX=""
28
      if [ $FILE != datar.nc ] ; then NX=",$nx" ; fi
Uwe Schulzweida's avatar
Uwe Schulzweida committed
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
      CDOCOMMAND="$CDO collgrid$NX xxx* $OFILE"
      echo "Running test: $NTEST"
      echo "$CDOCOMMAND"

      $CDO distgrid,$DIST $IFILE xxx
      test $? -eq 0 || let RSTAT+=1

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

      $CDO diff $IFILE $OFILE > $CDOOUT 2> $CDOERR
      test $? -eq 0 || let RSTAT+=1
      test -s $CDOOUT && let RSTAT+=1
      cat $CDOOUT $CDOERR
 
      rm -f $OFILE xxx*

      test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
      test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
    else
      test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST # SKIP netCDF not enabled"
    fi

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