Commit eaf99f65 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

test/Ensstat.test: test missing values.

parent 3e0df2ac
#! @BASH@
echo 1..12 # Number of tests to be executed.
echo 1..24 # Number of tests to be executed.
#
test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
#
TYPE="ens"
STATS="min max range sum avg mean std std1 var var1 skew kurt"
#
IFILE=$DATAPATH/ts_mm_5years
export CDO_FILE_SUFFIX=NULL
$CDO splityear $IFILE ${$}ts_year
IFILES="${$}ts_year????"
#
NTEST=1
#
for STAT in $STATS; do
if [ -z "$1" ] || [ $NTEST == $1 ]; then
RSTAT=0
RFILE=$DATAPATH/ymon${STAT}_ref
OFILE=ens${STAT}_res
CDOTEST="ens$STAT"
CDOCOMMAND="$CDO ens${STAT} $IFILES $OFILE"
echo "Running test: $NTEST"
echo "$CDOCOMMAND"
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDO diff $OFILE $RFILE
test $? -eq 0 || let RSTAT+=1
rm -f $OFILE
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
fi
let NTEST+=1
for RUN in 1 2; do
IFILE=$DATAPATH/ts_mm_5years
if [ $RUN = 2 ] ; then IFILE=${IFILE}_m ; fi
$CDO splityear $IFILE ${$}ts_year
IFILES="${$}ts_year????"
for STAT in $STATS; do
if [ -z "$1" ] || [ $NTEST == $1 ]; then
RSTAT=0
if [ $RUN = 2 ] ; then
RFILE=$DATAPATH/${TYPE}m${STAT}_ref
OFILE=${TYPE}m${STAT}_res
CDOTEST="${TYPE}$STAT with missing values"
else
RFILE=$DATAPATH/${TYPE}${STAT}_ref
OFILE=${TYPE}${STAT}_res
CDOTEST="${TYPE}$STAT"
fi
CDOCOMMAND="$CDO ${TYPE}${STAT} $IFILES $OFILE"
echo "Running test: $NTEST"
echo "$CDOCOMMAND"
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDO diff $OFILE $RFILE
test $? -eq 0 || let RSTAT+=1
rm -f $OFILE
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
fi
let NTEST+=1
done
rm -f $IFILES
done
#
rm -f $IFILES
#
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment