Testing: Check md5GridSection and scanning mode

This commit is contained in:
Shahram Najm 2023-05-10 16:40:54 +01:00
parent c8b0c0e97b
commit 61f5db1462
1 changed files with 16 additions and 1 deletions

View File

@ -10,6 +10,9 @@
. ./include.ctest.sh . ./include.ctest.sh
label="grib_md5_test"
temp=temp.$label.grib
test_md5() test_md5()
{ {
file=$ECCODES_SAMPLES_PATH/$1 file=$ECCODES_SAMPLES_PATH/$1
@ -19,7 +22,8 @@ test_md5()
[ "$result" = "$expected" ] [ "$result" = "$expected" ]
} }
####################################################################### # Check the md5GridSection for some sample files
# ------------------------------------------------
# GRIB edition 1 # GRIB edition 1
test_md5 "sh_sfc_grib1.tmpl" "5b68b3d2c6e834fd501a123391b6b8a2" test_md5 "sh_sfc_grib1.tmpl" "5b68b3d2c6e834fd501a123391b6b8a2"
test_md5 "sh_pl_grib1.tmpl" "5b68b3d2c6e834fd501a123391b6b8a2" test_md5 "sh_pl_grib1.tmpl" "5b68b3d2c6e834fd501a123391b6b8a2"
@ -29,3 +33,14 @@ test_md5 "gg_sfc_grib1.tmpl" "97451fbe92a77bdeb4582fadc9b65e9d"
test_md5 "sh_sfc_grib2.tmpl" "b10d32ebf4f91e52df0fc5d1deb57c3d" test_md5 "sh_sfc_grib2.tmpl" "b10d32ebf4f91e52df0fc5d1deb57c3d"
test_md5 "rotated_ll_pl_grib2.tmpl" "775bd4622d6becca2d2da9e308c97a7d" test_md5 "rotated_ll_pl_grib2.tmpl" "775bd4622d6becca2d2da9e308c97a7d"
test_md5 "gg_sfc_grib2.tmpl" "a63333bd3cb80563e66907bb66d82cda" test_md5 "gg_sfc_grib2.tmpl" "a63333bd3cb80563e66907bb66d82cda"
# Change some keys in the Grid Section and test md5 is different
# ------------------------------------------------
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -s swapScanningX=1 $input $temp
md1=`${tools_dir}/grib_get -p md5GridSection:s $input`
md2=`${tools_dir}/grib_get -p md5GridSection:s $temp`
[ "$md1" != "$md2" ]
# Clean up
rm -f $temp