Testing: GRIB2 packings grib_complex and grid_complex_spatial_differencing
@@ -106,14 +106,37 @@ cat > $tempRef <<EOF
padding_local1_1=00
EOF
diff $tempRef $tempData1
-rm -f $tempData1 $temp1 $tempRules
+rm -f $tempData1 $temp1 $tempRules $tempRef
# ECC-511: grid_complex_spatial_differencing
# To convert to simple packing, must pass in bitmapPresent=1
-# -------------------------------------------
+# ----------------------------------------------------------
infile=${data_dir}/gfs.complex.mvmu.grib2
-${tools_dir}/grib_set -r -s bitmapPresent=1,packingType=grid_simple $infile $temp2
-grib_check_key_equals $temp2 bitmapPresent,numberOfMissing,numberOfValues,numberOfPoints "1 556901 481339 1038240"
+tempSimple=temp.grib_bitmap.simple.grib
+${tools_dir}/grib_set -r -s bitmapPresent=1,packingType=grid_simple $infile $tempSimple
+grib_check_key_equals $tempSimple bitmapPresent,numberOfMissing,numberOfValues,numberOfPoints "1 556901 481339 1038240"
+stats=`${tools_dir}/grib_get -F%.2f -p max,min,avg $tempSimple`
+[ "$stats" = "2.81 0.00 0.30" ]
+
+# Simple to grid_complex
+tempComplex=temp.grib_bitmap.complex.grib
+${tools_dir}/grib_set -r -s packingType=grid_complex $tempSimple $tempComplex
+grib_check_key_equals $tempComplex packingType,bitmapPresent,numberOfMissing,numberOfValues,numberOfPoints "grid_complex 1 556901 481339 1038240"
+stats=`${tools_dir}/grib_get -F%.2f -p max,min,avg $tempComplex`
+[ "$stats" = "2.81 0.00 0.30" ]
+rm -f $tempComplex
+
+# Simple to grid_complex_spatial_differencing
+# TODO: numberOfMissing not yet calculated correctly
+tempComplexSD=temp.grib_bitmap.complexSD.grib
+${tools_dir}/grib_set -r -s packingType=grid_complex_spatial_differencing $tempSimple $tempComplexSD
+grib_check_key_equals $tempComplexSD packingType,bitmapPresent,numberOfValues,numberOfPoints "grid_complex_spatial_differencing 1 481339 1038240"
+stats=`${tools_dir}/grib_get -F%.2f -p max,min,avg $tempComplexSD`
+[ "$stats" = "2.81 0.00 0.30" ]
+rm -f $tempComplexSD
+rm -f $tempSimple
+
+
# Clean up
rm -f $tempData1 $tempData2 $temp1 $temp2 $tempRules
