Testing: Add test for constant field with dsf!=0. Also sanity test on grib_dump

This commit is contained in:
Shahram Najm 2020-07-17 12:30:53 +01:00
parent bed7997b90
commit 68f5517838
3 changed files with 47 additions and 3 deletions

View File

@ -48,9 +48,12 @@ endforeach()
################################################# #################################################
# These tests do not require any data downloads # These tests do not require any data downloads
list(APPEND tests_no_data_reqd list(APPEND tests_no_data_reqd
unit_tests
julian
grib_dump_samples
bufr_dump_samples
definitions definitions
grib_calendar grib_calendar
unit_tests
grib_md5 grib_md5
filter_substr filter_substr
grib_uerra grib_uerra
@ -59,8 +62,6 @@ list(APPEND tests_no_data_reqd
grib_ecc-967 grib_ecc-967
grib_ecc-1065 grib_ecc-1065
grib_ecc-1053 grib_ecc-1053
julian
bufr_dump_samples
bufr_json_samples bufr_json_samples
bufr_ecc-359 bufr_ecc-359
bufr_ecc-517 bufr_ecc-517

View File

@ -36,4 +36,13 @@ export ECCODES_FAIL_IF_LOG_MESSAGE=1
${tools_dir}/grib_set -r -s decimalScaleFactor=0 $infile $temp ${tools_dir}/grib_set -r -s decimalScaleFactor=0 $infile $temp
${tools_dir}/grib_set -r -s decimalScaleFactor=1 $infile $temp ${tools_dir}/grib_set -r -s decimalScaleFactor=1 $infile $temp
# Constant field with bitsPerValue=0 and decimalScaleFactor!=0
sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_set -s decimalScaleFactor=3 $sample1 $temp
grib_check_key_equals $temp min,max,const,decimalScaleFactor,referenceValue '47485.4 47485.4 1 3 47485.4'
${tools_dir}/grib_set -s decimalScaleFactor=3 $sample2 $temp
grib_check_key_equals $temp min,max,const,decimalScaleFactor,referenceValue '1 1 1 3 1'
rm -f $temp rm -f $temp

34
tests/grib_dump_samples.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.sh
# Define a common label for all the tmp files
label="grib_dump_samples_test"
temp=${label}".temp"
# Test selected sample GRIB files
samples="
GRIB1.tmpl
GRIB2.tmpl
sh_ml_grib1.tmpl
sh_ml_grib2.tmpl
reduced_gg_pl_48_grib1.tmpl
reduced_gg_pl_48_grib2.tmpl
regular_ll_sfc_grib1.tmpl
regular_ll_sfc_grib2.tmpl
"
for file in $samples; do
sf="$ECCODES_SAMPLES_PATH/$file"
${tools_dir}/grib_dump -O $sf >/dev/null
done
rm -f $temp