Merge pull request #8 in PUBLIC/eccodes from DWD/eccodes:feature/GRIB-179-add-support-for-data-repr-template-5.42 to develop

* commit '8125bb20ab75e5809cb193728b17e68181749cb4':
  GRIB-179: Apply fix for proper CCSDS encoding
  GRIB-179: Add test for data when (bitsPerValue % 8 != 0)
This commit is contained in:
Shahram Najm 2016-07-13 17:22:11 +01:00
commit 1d9c2dda13
3 changed files with 12 additions and 2 deletions

View File

@ -15,7 +15,7 @@ include "grib2/template.5.original_values.def";
unsigned[1] ccsdsFlags : dump;
flagbit AEC_DATA_SIGNED_OPTION_MASK(ccsdsFlags,0) = 0;
flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 0;
flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 1;
flagbit AEC_DATA_MSB_OPTION_MASK(ccsdsFlags,2) = 1;
flagbit AEC_DATA_PREPROCESS_OPTION_MASK(ccsdsFlags,3) = 1;
flagbit AEC_RESTRICTED_OPTION_MASK(ccsdsFlags,4) = 0;

View File

@ -275,7 +275,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
*/
bits8 = ((bits_per_value + 7)/8)*8;
size = n_vals * (bits_per_value + 7)/8;
size = n_vals * ((bits_per_value + 7)/8);
decoded = grib_context_buffer_malloc_clear(a->context,size);
if(!decoded) {
err = GRIB_OUT_OF_MEMORY;

View File

@ -69,3 +69,13 @@ res3=`${tools_dir}grib_get '-F%1.2f' -p min,max,avg $outfile2`
[ "$res1" = "$res3" ]
rm -f $outfile1 $outfile2 || true
infile=${data_dir}/tigge_ecmwf.grib2
outfile1=$infile.tmp_ccsds.1
outfile2=$infile.tmp_ccsds.2
${tools_dir}grib_set -r -s bitsPerValue=17 $infile $outfile1
${tools_dir}grib_set -r -s packingType=grid_ccsds $outfile1 $outfile2
${tools_dir}grib_compare -P -c data:n $outfile1 $outfile2
rm -f $outfile1 $outfile2