ECC-1263: GRIB2: CCSDS packing: Assertion when creating constant field

This commit is contained in:
Shahram Najm 2021-07-14 19:24:46 +01:00
parent cb446e5b19
commit 43ed8bae26
2 changed files with 12 additions and 7 deletions

View File

@ -397,13 +397,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
#endif
if ((err = grib_set_double_internal(hand, self->reference_value, val[0])) != GRIB_SUCCESS)
return err;
{
/* Make sure we can decode it again */
double ref = 1e-100;
grib_get_double_internal(hand, self->reference_value, &ref);
/*printf("%g %g %g\n",reference_value,ref,reference_value-ref);*/
Assert(ref == reference_value);
}
if ((err = grib_set_long_internal(hand, self->number_of_values, n_vals)) != GRIB_SUCCESS)
return err;

View File

@ -25,6 +25,18 @@ outfile1=$infile.tmp_ccsds.1
outfile2=$infile.tmp_ccsds.2
rm -f $outfile1 $outfile2
# ECC-1263
# ---------
grib2_sample=$ECCODES_SAMPLES_PATH/gg_sfc_grib2.tmpl
${tools_dir}/grib_set -s packingType=grid_ccsds $grib2_sample $outfile1
${tools_dir}/grib_set -d1 $outfile1 $outfile2
grib_check_key_equals $grib2_sample packingType,const "grid_simple 0"
grib_check_key_equals $outfile2 packingType,const "grid_ccsds 1"
rm -f $outfile1 $outfile2
# Change packingType
# ------------------
${tools_dir}/grib_set -r -s packingType=grid_simple $infile $outfile1
${tools_dir}/grib_compare -b $BLACKLIST $outfile1 $infile > $REDIRECT