Commit 3d02a9ce authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added test/EOFcoeff.test.in

parent 9c5af674
...@@ -290,6 +290,7 @@ AC_CONFIG_FILES([ ...@@ -290,6 +290,7 @@ AC_CONFIG_FILES([
test/Copy_netcdf.test test/Copy_netcdf.test
test/Detrend.test test/Detrend.test
test/EOF.test test/EOF.test
test/EOFcoeff.test
test/Enspctl.test test/Enspctl.test
test/Ensstat.test test/Ensstat.test
test/Expr.test test/Expr.test
......
...@@ -6,19 +6,20 @@ test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data" ...@@ -6,19 +6,20 @@ test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data"
# #
declare -a STATS declare -a STATS
STATS=("detrend" "trend" "subtrend") STATS=("detrend" "trend" "subtrend")
# #
IFILE=$DATAPATH/detrend_data IFILE=$DATAPATH/detrend_data
NTEST=1 NTEST=1
# #
RSTAT=0
RFILE=$DATAPATH/detrend_ref RFILE=$DATAPATH/detrend_ref
OFILE=detrend_res OFILE=detrend_res
# #
# detrend # detrend
# #
RSTAT=0
CDOCOMMAND="$CDO ${STATS[0]} $IFILE $OFILE" CDOCOMMAND="$CDO ${STATS[0]} $IFILE $OFILE"
CDOTEST="${STATS[0]}"
echo "Running test: $NTEST" echo "Running test: $NTEST"
echo "$CDOCOMMAND" echo "$CDOCOMMAND"
...@@ -34,10 +35,13 @@ test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST" ...@@ -34,10 +35,13 @@ test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
let NTEST+=1 let NTEST+=1
rm -f $OFILE rm -f $OFILE
# #
# trend # trend/subtrend
# #
RSTAT=0
CDOCOMMAND="$CDO ${STATS[1]} $IFILE ta tb" CDOCOMMAND="$CDO ${STATS[1]} $IFILE ta tb"
CDOTEST="${STATS[1]}/${STATS[2]}"
echo "Running test: $NTEST" echo "Running test: $NTEST"
echo "$CDOCOMMAND" echo "$CDOCOMMAND"
...@@ -55,15 +59,11 @@ test $? -eq 0 || let RSTAT+=1 ...@@ -55,15 +59,11 @@ test $? -eq 0 || let RSTAT+=1
$CDO diff $OFILE $RFILE $CDO diff $OFILE $RFILE
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST" test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
let NTEST+=1 let NTEST+=1
rm -f $OFILE rm -f $OFILE
rm -f ta tb rm -f ta tb
#
# #
exit 0 exit 0
#! @BASH@ #! @BASH@
# echo 1..4 # Number of tests to be executed.
echo 1..8 # Number of tests to be executed.
# #
test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG" test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/" test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
# #
export CDO_FILE_SUFFIX=NULL export CDO_FILE_SUFFIX=NULL
export CDO_WEIGHT_MODE=off export CDO_WEIGHT_MODE=off
#export CDO_SVD_MODE=danielson_lanczos
# #
FORMAT="-f srv -b 32" FORMAT="-f srv -b 32"
STATS="eof eof3d"
#
NTEST=1 NTEST=1
######################################################
IFILE=$DATAPATH/psl_DJF_anom.grb IFILE=$DATAPATH/psl_DJF_anom.grb
RFILE1=$DATAPATH/eval_ref RFILE1=$DATAPATH/eval_ref
RFILE2=$DATAPATH/eof_ref RFILE2=$DATAPATH/eof_ref
RFILE3=$DATAPATH/pcoeff00000
OFILE1=eval_res OFILE1=eval_res
OFILE2=eof_res OFILE2=eof_res
OFILE3=res_pcoeff
#
declare -a STATS
STATS=("eof" "eofcoeff" "eof3d" "eofcoeff3d")
# #
RSTAT=0 for STAT in $STATS; do
#
for X in 0 1; do
for MODE in jacobi danielson_lanczos; do for MODE in jacobi danielson_lanczos; do
RSTAT=0
export CDO_SVD_MODE=$MODE export CDO_SVD_MODE=$MODE
#--------------------------------------------------------------
CDOTEST="eof${DIM} - $MODE" CDOTEST="${STAT} - $MODE"
CDOCOMMAND="$CDO $FORMAT ${STATS[$x]},1 $IFILE $OFILE1 $OFILE2" CDOCOMMAND="$CDO $FORMAT ${STAT},1 $IFILE $OFILE1 $OFILE2"
echo "$CDOCOMMAND" echo "$CDOCOMMAND"
#
$CDOCOMMAND $CDOCOMMAND
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
#
$CDO diff,abslim=1e-8 $OFILE1 $RFILE1 $CDO diff,abslim=1e-8 $OFILE1 $RFILE1
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
#
$CDO diff,abslim=1e-7 -abs $OFILE2 -abs $RFILE2 $CDO diff,abslim=1e-7 -abs $OFILE2 -abs $RFILE2
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
#
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST" test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
#
let NTEST+=1 let NTEST+=1
RSTAT=0
#--------------------------------------------------------------
CDOTEST="eofcoeff${DIM} - $MODE"
#
CDOCOMMAND="$CDO $FORMAT ${STATS[$x + 1]} $OFILE2 $IFILE $OFILE3"
echo "$CDOCOMMAND"
#
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
#
$CDO diff,abslim=0.02 -abs ${OFILE3}00000 -abs $RFILE3
test $? -eq 0 || let RSTAT+=1
#
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
#
let NTEST+=1
RSTAT=0
#--------------------------------------------------------------
rm -f $OFILE1 $OFILE2 ${OFILE3}00000 rm -f $OFILE1 $OFILE2 ${OFILE3}00000
done done
done done
#
# #
exit 0 exit 0
#! @BASH@
echo 1..4 # 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/"
#
export CDO_FILE_SUFFIX=NULL
export CDO_WEIGHT_MODE=off
#
FORMAT="-f srv -b 32"
STATS="eofcoeff eofcoeff3d"
#
NTEST=1
IFILE=$DATAPATH/psl_DJF_anom.grb
RFILE=$DATAPATH/pcoeff00000
OFILE=res_pcoeff
#
for STAT in $STATS; do
for MODE in jacobi danielson_lanczos; do
RSTAT=0
export CDO_SVD_MODE=$MODE
CDOTEST="${STAT} - $MODE"
CDOCOMMAND="$CDO $FORMAT ${STAT} $DATAPATH/eof_ref $IFILE $OFILE"
echo "$CDOCOMMAND"
$CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDO diff,abslim=0.02 -abs ${OFILE}00000 -abs $RFILE
test $? -eq 0 || let RSTAT+=1
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
let NTEST+=1
rm -f ${OFILE}00000
done
done
#
exit 0
...@@ -4,9 +4,8 @@ echo 1..3 # Number of tests to be executed. ...@@ -4,9 +4,8 @@ echo 1..3 # Number of tests to be executed.
test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG" test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/" test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
# #
FORMAT="-f srv -b 32" FORMAT="-f srv -b 32"
STATS="expr aexpr"
ABSLIMMAX=0.001 ABSLIMMAX=0.001
# #
IFILE=$DATAPATH/pl_data IFILE=$DATAPATH/pl_data
...@@ -14,38 +13,33 @@ NTEST=1 ...@@ -14,38 +13,33 @@ NTEST=1
# #
FINSTR=finstr FINSTR=finstr
# #
#
function testfunc() function testfunc()
{ {
STATS="expr aexpr"
RSTAT=0 RSTAT=0
CDOTEST="instruction set $NTEST" CDOTEST="instruction set $NTEST"
echo "Running test: $NTEST - $CDOTEST" echo "Running test: $NTEST - $CDOTEST"
for EXPR in $STATS; do for STAT in $STATS; do
RFILE=$DATAPATH/${EXPR}${NTEST}_ref RFILE=$DATAPATH/${STAT}${NTEST}_ref
OFILE=${EXPR}${NTEST}_res OFILE=${STAT}${NTEST}_res
for FILE in "" "f"; do if [ "$STAT" = "exprf" ] ; then
echo $INSTR > $FINSTR
CDOCOMMAND="$CDO $FORMAT $STAT,$FINSTR $IFILE $OFILE"
else
CDOCOMMAND="$CDO $FORMAT $STAT,$INSTR $IFILE $OFILE"
fi
if [ "$FILE" = "f" ] ; then echo "$CDOCOMMAND"
echo $INSTR > $FINSTR
CDOCOMMAND="$CDO $FORMAT $EXPR${FILE},$FINSTR $IFILE $OFILE"
else
CDOCOMMAND="$CDO $FORMAT $EXPR,$INSTR $IFILE $OFILE"
fi
echo "$CDOCOMMAND" $CDOCOMMAND
test $? -eq 0 || let RSTAT+=1
$CDOCOMMAND $CDO diff,abslim=$ABSLIMMAX $RFILE $OFILE
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
$CDO diff,abslim=$ABSLIMMAX $RFILE $OFILE rm -f $OFILE $FINSTR
test $? -eq 0 || let RSTAT+=1
rm -f $OFILE $FINSTR
done
done done
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
...@@ -62,7 +56,5 @@ testfunc ...@@ -62,7 +56,5 @@ testfunc
# #
INSTR="C1=3+4;C2=C1-7;r1=C2+fldmean(var130);r2=vertmean(var130)+C2;" INSTR="C1=3+4;C2=C1-7;r1=C2+fldmean(var130);r2=vertmean(var130)+C2;"
testfunc testfunc
#
# #
exit 0 exit 0
...@@ -4,8 +4,6 @@ echo 1..16 # Number of tests to be executed. ...@@ -4,8 +4,6 @@ echo 1..16 # Number of tests to be executed.
test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG" test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/" test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
# #
FORMATS="srv ext ieg grb grb2 nc nc2 nc4" FORMATS="srv ext ieg grb grb2 nc nc2 nc4"
# #
NTEST=1 NTEST=1
...@@ -55,11 +53,8 @@ for OPERATOR in $STATS; do ...@@ -55,11 +53,8 @@ for OPERATOR in $STATS; do
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
test -s $FILE || let RSTAT+=1 test -s $FILE || let RSTAT+=1
$CDO diff,abslim=0.0001 $FILE $RFILE $CDO diff,abslim=0.0001 $FILE $RFILE
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
else else
OFILE=file_${DATATYPE}_${FORMAT}_res OFILE=file_${DATATYPE}_${FORMAT}_res
CDOCOMMAND="$CDO copy $FILE $OFILE" CDOCOMMAND="$CDO copy $FILE $OFILE"
...@@ -68,11 +63,9 @@ for OPERATOR in $STATS; do ...@@ -68,11 +63,9 @@ for OPERATOR in $STATS; do
$CDOCOMMAND $CDOCOMMAND
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
$CDO diff,abslim=0.0001 $FILE $OFILE $CDO diff,abslim=0.0001 $FILE $OFILE
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
rm -f $FILE $OFILE rm -f $FILE $OFILE
fi fi
done done
...@@ -83,11 +76,8 @@ for OPERATOR in $STATS; do ...@@ -83,11 +76,8 @@ for OPERATOR in $STATS; do
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST # SKIP $FILEFORMAT not enabled" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST # SKIP $FILEFORMAT not enabled"
fi fi
fi fi
let NTEST+=1 let NTEST+=1
done done
done done
#
# #
exit 0 exit 0
...@@ -12,7 +12,6 @@ ABSLIMMAX=0.001 ...@@ -12,7 +12,6 @@ ABSLIMMAX=0.001
ABSLIMDIS=0.2 ABSLIMDIS=0.2
ABSLIMSCON=0.25 ABSLIMSCON=0.25
FORMAT="-f srv -b 32" FORMAT="-f srv -b 32"
GRIDS="n16 n32" GRIDS="n16 n32"
# #
...@@ -38,7 +37,6 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do ...@@ -38,7 +37,6 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do
OFILE=${GRID}_${RMOD}_$$ OFILE=${GRID}_${RMOD}_$$
RFILE=$DATAPATH/${GRID}_${RMOD:3}_ref RFILE=$DATAPATH/${GRID}_${RMOD:3}_ref
CDOTEST="gen${RMOD} $GRID $GRIDTYPE" CDOTEST="gen${RMOD} $GRID $GRIDTYPE"
CDOCOMMAND="$CDO $FORMAT $RMOD,$GRID $SETGRID $IFILE remapweights" CDOCOMMAND="$CDO $FORMAT $RMOD,$GRID $SETGRID $IFILE remapweights"
...@@ -58,8 +56,6 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do ...@@ -58,8 +56,6 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do
$CDO diff,abslim=$ABSLIM $OFILE $RFILE $CDO diff,abslim=$ABSLIM $OFILE $RFILE
test $? -eq 0 || let RSTAT+=1 test $? -eq 0 || let RSTAT+=1
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
if [ $RMOD = dis ]; then if [ $RMOD = dis ]; then
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST # TODO check depends on optimization" test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST # TODO check depends on optimization"
...@@ -76,7 +72,5 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do ...@@ -76,7 +72,5 @@ for GRIDTYPE in "regular" "curvilinear" "unstructured"; do
done done
done done
done done
#
# #
exit 0 exit 0
...@@ -3,9 +3,6 @@ echo 1..1 # Number of tests to be executed. ...@@ -3,9 +3,6 @@ echo 1..1 # Number of tests to be executed.
# #
test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG" test -n "$CDO" || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/" test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
#
# #
IFILE=$DATAPATH/pl_data.grb IFILE=$DATAPATH/pl_data.grb
OFILE=pl_data.grb OFILE=pl_data.grb
...@@ -42,7 +39,5 @@ rm -f $OFILE $RFILE1 $RFILE2 ...@@ -42,7 +39,5 @@ rm -f $OFILE $RFILE1 $RFILE2
test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST" test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST" test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
#
# #
exit 0 exit 0
...@@ -23,11 +23,12 @@ TESTS =\ ...@@ -23,11 +23,12 @@ TESTS =\
Copy_netcdf.test \ Copy_netcdf.test \
Detrend.test \ Detrend.test \
EOF.test \ EOF.test \
EOFcoeff.test \
Enspctl.test \ Enspctl.test \
Ensstat.test \ Ensstat.test \
Expr.test \ Expr.test \
File.test \ File.test \
Filter.test \ Filter.test \
Fldpctl.test \ Fldpctl.test \
Fldstat.test \ Fldstat.test \
Genweights.test \ Genweights.test \
......
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