mirror of https://github.com/ecmwf/eccodes.git
ECC-1782: Repacking sample GRIB2.tmpl fails when ECCODES_GRIB_DATA_QUALITY_CHECKS=1
This commit is contained in:
parent
5521445e56
commit
84f23bf502
Binary file not shown.
|
@ -26,9 +26,9 @@ sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
|
|||
# ------------------
|
||||
infile=$sample_grib2
|
||||
result=$(${tools_dir}/grib_get -p maximum:s $infile)
|
||||
[ "$result" = "1" ]
|
||||
[ "$result" = "273" ]
|
||||
result=$(${tools_dir}/grib_get -s formatForDoubles=%e -p maximum:s $infile)
|
||||
[ "$result" = "1.000000e+00" ]
|
||||
[ "$result" = "2.730000e+02" ]
|
||||
|
||||
infile=${data_dir}/sample.grib2
|
||||
result=$(${tools_dir}/grib_get -s formatForDoubles=%e -p minimum:s $infile)
|
||||
|
|
|
@ -28,6 +28,13 @@ sample_ccsds=$ECCODES_SAMPLES_PATH/ccsds_grib2.tmpl
|
|||
unset ECCODES_GRIB_DATA_QUALITY_CHECKS
|
||||
unset ECCODES_EXTRA_DEFINITION_PATH
|
||||
|
||||
echo "Data quality checks enabled. Packing samples should work"
|
||||
# -------------------------------------------------------------
|
||||
export ECCODES_GRIB_DATA_QUALITY_CHECKS=1
|
||||
${tools_dir}/grib_copy -r $sample_g1 /dev/null
|
||||
${tools_dir}/grib_copy -r $sample_g2 /dev/null
|
||||
unset ECCODES_GRIB_DATA_QUALITY_CHECKS
|
||||
|
||||
# These input files are 2m temperature with min=221.76 and max=311.619
|
||||
input1=${data_dir}/reduced_gaussian_surface.grib1
|
||||
input2=${data_dir}/reduced_gaussian_surface.grib2
|
||||
|
@ -51,6 +58,7 @@ set -e
|
|||
grep -q 'more than the allowable limit' $tempErr
|
||||
unset ECCODES_DEBUG
|
||||
|
||||
|
||||
echo "Data quality checks enabled but only as a warning. Repacking should pass..."
|
||||
# --------------------------------------------------------------------------------
|
||||
export ECCODES_GRIB_DATA_QUALITY_CHECKS=2
|
||||
|
@ -110,7 +118,8 @@ ${tools_dir}/grib_set -s paramId=$pid,scaleValuesBy=0.01 $input2 $tempOut
|
|||
|
||||
echo "Test close to the limit..."
|
||||
# ---------------------------------
|
||||
${tools_dir}/grib_set -s paramId=$pid $sample_g2 $tempGrib2
|
||||
# The GRIB2 sample has max values of 273. We need to use 1 for this test
|
||||
${tools_dir}/grib_set -s paramId=$pid,values=1 $sample_g2 $tempGrib2
|
||||
${tools_dir}/grib_set -s scaleValuesBy=3 $tempGrib2 $tempOut # OK
|
||||
set +e
|
||||
${tools_dir}/grib_set -s scaleValuesBy=3.6 $tempGrib2 $tempOut
|
||||
|
@ -189,11 +198,13 @@ cat > $tempDir/param_limits.def <<EOF
|
|||
} : double_type, hidden;
|
||||
EOF
|
||||
# Step of 12 satisfies the condition: it is even and > 4
|
||||
${tools_dir}/grib_set -s paramId=260509,step=12,scaleValuesBy=1000 $sample_g2 $tempGrib2
|
||||
# The GRIB2 sample has max values of 273. We need to use 1 for this test
|
||||
${tools_dir}/grib_set -s paramId=260509,step=12,values=1,scaleValuesBy=1000 $sample_g2 $tempGrib2
|
||||
|
||||
# Step of 0 doesn't satisfy the condition so will use 400
|
||||
# The GRIB2 sample has max values of 273. We need to use 1 for this test
|
||||
set +e
|
||||
${tools_dir}/grib_set -s paramId=260509,scaleValuesBy=1000 $sample_g2 $tempGrib2
|
||||
${tools_dir}/grib_set -s paramId=260509,values=1,scaleValuesBy=1000 $sample_g2 $tempGrib2
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
. ./include.ctest.sh
|
||||
|
||||
label="grib_decimalPrecision_test"
|
||||
|
||||
temp=temp.$label.grib
|
||||
REDIRECT=/dev/null
|
||||
|
||||
files="regular_latlon_surface.grib2 \
|
||||
|
@ -29,7 +32,6 @@ for file in $files; do
|
|||
done
|
||||
|
||||
# ECC-458: spectral_complex packing
|
||||
temp=temp.grib_decimalPrecision.grib
|
||||
infile=${data_dir}/spectral_complex.grib1
|
||||
# Catch errors re negative values
|
||||
export ECCODES_FAIL_IF_LOG_MESSAGE=1
|
||||
|
@ -42,7 +44,7 @@ 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'
|
||||
|
||||
grib_check_key_equals $temp min,max,const,decimalScaleFactor,referenceValue '273 273 1 3 273'
|
||||
|
||||
# Clean up
|
||||
rm -f $temp
|
||||
|
|
|
@ -23,6 +23,6 @@ $sample_grib2 $temp
|
|||
|
||||
grib_check_key_equals $temp Ni,Nj "16 31"
|
||||
grib_check_key_equals $temp centreLatitudeInDegrees,centreLongitudeInDegrees "0 30"
|
||||
grib_check_key_equals $temp minimum,maximum "1 1"
|
||||
grib_check_key_equals $temp minimum,maximum "273 273"
|
||||
|
||||
rm -f $temp
|
||||
|
|
Loading…
Reference in New Issue