ECC-477: Redundant error message changing packing from CCSDS to grid_simple

This commit is contained in:
Shahram Najm 2017-10-09 15:01:46 +01:00
parent 421b2ebf82
commit c0c6bc518b
4 changed files with 21 additions and 9 deletions

View File

@ -195,7 +195,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
if (err) return err;
if(!grib_find_accessor(grib_handle_of_accessor(a),self->bitmap))
return grib_get_double_array_internal(grib_handle_of_accessor(a),self->coded_values,val,len);
return grib_get_double_array(grib_handle_of_accessor(a),self->coded_values,val,len);
if((err = grib_get_size(grib_handle_of_accessor(a),self->coded_values,&coded_n_vals)) != GRIB_SUCCESS)
return err;
@ -223,7 +223,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
coded_vals = (double*)grib_context_malloc(a->context,coded_n_vals*sizeof(double));
if(coded_vals == NULL) return GRIB_OUT_OF_MEMORY;
if((err = grib_get_double_array_internal(grib_handle_of_accessor(a),self->coded_values,coded_vals,&coded_n_vals))
if((err = grib_get_double_array(grib_handle_of_accessor(a),self->coded_values,coded_vals,&coded_n_vals))
!= GRIB_SUCCESS)
{
grib_context_free(a->context,coded_vals);

View File

@ -230,8 +230,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS)
return err;
if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->ccsds_flags,&ccsds_flags)) != GRIB_SUCCESS)
/* ECC-477: Don't call grib_get_long_internal to suppress error message being output */
if((err = grib_get_long(grib_handle_of_accessor(a),self->ccsds_flags,&ccsds_flags)) != GRIB_SUCCESS)
return err;
if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->ccsds_block_size, &ccsds_block_size)) != GRIB_SUCCESS)
return err;
if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS)

View File

@ -489,7 +489,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
if((err = grib_get_long_internal(gh,self->binary_scale_factor,&binary_scale_factor )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->decimal_scale_factor,&decimal_scale_factor )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->typeOfOriginalFieldValues,&typeOfOriginalFieldValues )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->groupSplittingMethodUsed,&groupSplittingMethodUsed )) != GRIB_SUCCESS) return err;
/* Don't call grib_get_long_internal to suppress error message being output */
if((err = grib_get_long(gh,self->groupSplittingMethodUsed,&groupSplittingMethodUsed )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->missingValueManagementUsed,&missingValueManagementUsed )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->primaryMissingValueSubstitute,&primaryMissingValueSubstitute )) != GRIB_SUCCESS) return err;
if((err = grib_get_long_internal(gh,self->secondaryMissingValueSubstitute,&secondaryMissingValueSubstitute )) != GRIB_SUCCESS) return err;

View File

@ -37,8 +37,8 @@ infile=${data_dir}/ccsds.grib2
outfile1=$infile.tmp_ccsds.1
outfile2=$infile.tmp_ccsds.2
rm -f $outfile1 $outfile2 || true
${tools_dir}/grib_set -f -r -s packingType=grid_simple $infile $outfile1 2> $REDIRECT
rm -f $outfile1 $outfile2
${tools_dir}/grib_set -f -r -s packingType=grid_simple $infile $outfile1
${tools_dir}/grib_compare -P -b $BLACKLIST $outfile1 $infile > $REDIRECT
${tools_dir}/grib_set -r -s packingType=grid_ccsds $outfile1 $outfile2
@ -52,7 +52,7 @@ then
exit 1
fi
rm -f $outfile1 $outfile2 || true
rm -f $outfile1 $outfile2
infile=${data_dir}/reduced_latlon_surface.grib2
outfile1=$infile.tmp_ccsds.1
@ -60,7 +60,7 @@ outfile2=$infile.tmp_ccsds.2
${tools_dir}/grib_set -r -s packingType=grid_ccsds $infile $outfile1
${tools_dir}/grib_compare -P -b $BLACKLIST $infile $outfile1 > $REDIRECT
${tools_dir}/grib_set -f -r -s packingType=grid_simple $outfile1 $outfile2 2> $REDIRECT
${tools_dir}/grib_set -f -r -s packingType=grid_simple $outfile1 $outfile2
${tools_dir}/grib_compare -P -b $BLACKLIST $outfile2 $outfile1 > $REDIRECT
res1=`${tools_dir}/grib_get '-F%1.2f' -p min,max,avg $infile`
@ -69,7 +69,7 @@ res3=`${tools_dir}/grib_get '-F%1.2f' -p min,max,avg $outfile2`
[ "$res1" = "$res2" ]
[ "$res1" = "$res3" ]
rm -f $outfile1 $outfile2 || true
rm -f $outfile1 $outfile2
# ECC-297
infile=${data_dir}/tigge_ecmwf.grib2
@ -80,4 +80,11 @@ ${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
# ECC-477: redundant error message during conversion
infile=${data_dir}/ccsds.grib2
rm -f $outfile2
${tools_dir}/grib_set -f -r -s packingType=grid_simple $infile $outfile1 >$outfile2 2>&1
# there should be no error messages printed (to stdout or stderr)
[ ! -s $outfile2 ]
rm -f $outfile1 $outfile2