ECC-1150: Added more tests

This commit is contained in:
Shahram Najm 2020-09-29 16:14:31 +01:00
parent 279eaf6f51
commit 4766ba34cb
1 changed files with 24 additions and 3 deletions

View File

@ -12,19 +12,21 @@
set -u
# ---------------------------------------------------------
# This is the test for the JIRA issue ECC-1150
# ECC-1150: keys 'lowerLimit' and 'upperLimit' cannot be MISSING
# ECC-1150: keys 'lowerLimit' & 'upperLimit' cannot be MISSING
# ---------------------------------------------------------
label="grib_ecc-1150-test"
tempGrib=temp.${label}.grib
tempFilt=temp.${label}.filt
in=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
# Lower limit
# -------------
${tools_dir}/grib_set -s \
productDefinitionTemplateNumber=5,scaleFactorOfLowerLimit=missing,scaledValueOfLowerLimit=missing \
$in $tempGrib
grib_check_key_equals $tempGrib lowerLimit MISSING
grib_check_key_equals $tempGrib upperLimit 0
grib_check_key_equals $tempGrib lowerLimit,upperLimit 'MISSING 0'
cat > $tempFilt <<EOF
print "lower=[lowerLimit], upper=[upperLimit]";
@ -37,5 +39,24 @@ EOF
${tools_dir}/grib_filter $tempFilt $tempGrib
# Try upper limit too
# --------------------
${tools_dir}/grib_set -s \
productDefinitionTemplateNumber=5,scaleFactorOfUpperLimit=missing,scaledValueOfUpperLimit=missing \
$in $tempGrib
grib_check_key_equals $tempGrib lowerLimit,upperLimit '0 MISSING'
cat > $tempFilt <<EOF
print "lower=[lowerLimit], upper=[upperLimit]";
transient llim_missing = missing(lowerLimit);
transient ulim_missing = missing(upperLimit);
assert( llim_missing == 0 );
assert( ulim_missing == 1 );
EOF
${tools_dir}/grib_filter $tempFilt $tempGrib
# Clean up
rm -f $tempGrib $tempFilt