mirror of https://github.com/ecmwf/eccodes.git
ECC-1339: Add tests
This commit is contained in:
parent
3e29939e05
commit
3dd4faaa4b
|
@ -10,7 +10,9 @@
|
|||
|
||||
. ./include.sh
|
||||
|
||||
# This file does not have a bitmap
|
||||
infile=${data_dir}/regular_latlon_surface.grib1
|
||||
|
||||
shdata=${data_dir}/spherical_model_level.grib1
|
||||
suff=_ieee_test.grib1
|
||||
outsimple=simple$suff
|
||||
|
@ -34,32 +36,32 @@ cat > r.filter <<EOF
|
|||
print "[values%g]";
|
||||
EOF
|
||||
|
||||
${tools_dir}/grib_filter -o $outsimple w.filter $infile
|
||||
${tools_dir}/grib_filter -o $outsimple w.filter $infile
|
||||
|
||||
${tools_dir}/grib_filter r.filter $outsimple > $outsimple.txt
|
||||
diff $outsimple.txt ${data_dir}/ieee_test.good
|
||||
|
||||
${tools_dir}/grib_set -r -s packingType=grid_ieee $outsimple $out32
|
||||
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
||||
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
||||
diff $out32.txt ${data_dir}/ieee_test.good
|
||||
|
||||
GRIB_IEEE_PACKING=32
|
||||
export GRIB_IEEE_PACKING
|
||||
${tools_dir}/grib_filter -o $out32 w.filter $infile
|
||||
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
||||
${tools_dir}/grib_filter -o $out32 w.filter $infile
|
||||
${tools_dir}/grib_filter r.filter $out32 > $out32.txt
|
||||
diff $out32.txt ${data_dir}/ieee_test.good
|
||||
grib_check_key_equals $out32 'packingType,precision' 'grid_ieee 1'
|
||||
|
||||
GRIB_IEEE_PACKING=64
|
||||
export GRIB_IEEE_PACKING
|
||||
${tools_dir}/grib_filter -o $out64 w.filter $infile
|
||||
${tools_dir}/grib_filter r.filter $out64 > $out64.txt
|
||||
${tools_dir}/grib_filter -o $out64 w.filter $infile
|
||||
${tools_dir}/grib_filter r.filter $out64 > $out64.txt
|
||||
diff $out64.txt ${data_dir}/ieee_test.good
|
||||
grib_check_key_equals $out64 'packingType,precision' 'grid_ieee 2'
|
||||
|
||||
|
||||
rm -f $outsimple $out32 $out64 $out32.txt $out64.txt
|
||||
rm -f ${data_dir}/$outsimple.txt ${data_dir}/$out32.txt ${data_dir}/$out64.txt
|
||||
rm -f ${data_dir}/$outsimple.txt ${data_dir}/$out32.txt ${data_dir}/$out64.txt
|
||||
rm -f w.filter $outsimple.txt
|
||||
|
||||
${tools_dir}/grib_filter r.filter $shdata > $shdata.txt
|
||||
|
@ -97,6 +99,21 @@ stats2=`${tools_dir}/grib_get -M -F%.3f -p min,max,avg $temp`
|
|||
grib_check_key_equals $temp numberOfEffectiveValues,numberOfValues,numberOfMissing '214661 214661 98701'
|
||||
grib_check_key_equals $temp totalLength 899004
|
||||
|
||||
echo "Test ECCODES_GRIB_IEEE_PACKING on GRIB2 with bitmap..."
|
||||
# ------------------------------------------------------------
|
||||
infile=${data_dir}/reduced_latlon_surface.grib2
|
||||
grib_check_key_equals $infile bitmapPresent 1
|
||||
ECCODES_GRIB_IEEE_PACKING=32 ${tools_dir}/grib_copy -r $infile $temp
|
||||
grib_check_key_equals $temp packingType grid_ieee
|
||||
${tools_dir}/grib_compare -c data:n -R all=6e-8 $infile $temp
|
||||
|
||||
echo "Test ECCODES_GRIB_IEEE_PACKING on GRIB2 without bitmap..."
|
||||
# --------------------------------------------------------------
|
||||
infile=${data_dir}/regular_latlon_surface.grib2
|
||||
grib_check_key_equals $infile bitmapPresent 0
|
||||
ECCODES_GRIB_IEEE_PACKING=32 ${tools_dir}/grib_copy -r $infile $temp
|
||||
grib_check_key_equals $temp packingType grid_ieee
|
||||
${tools_dir}/grib_compare -c data:n $infile $temp
|
||||
|
||||
|
||||
echo "Test raw packing on GRIB1 with bitmap..."
|
||||
|
|
Loading…
Reference in New Issue