ECC-1986: GRIB1: Setting field values in second order packing

This commit is contained in:
shahramn 2024-11-26 10:03:22 +00:00
parent ddb6bcf435
commit f4279fc7bc
2 changed files with 15 additions and 2 deletions

View File

@ -584,8 +584,6 @@ int grib_accessor_data_g1second_order_general_extended_packing_t::pack_double(co
grib_handle* handle = grib_handle_of_accessor(this);
long optimize_scaling_factor = 0;
double_dirty_ = 1;
numberOfValues = *len;
min = max = val[0];
@ -606,6 +604,9 @@ int grib_accessor_data_g1second_order_general_extended_packing_t::pack_double(co
if ((ret = grib_get_long_internal(handle, optimize_scaling_factor_, &optimize_scaling_factor)) != GRIB_SUCCESS)
return ret;
// ECC-1986: Make sure we set the dirty flag after calling get_bits_per_value
double_dirty_ = 1;
if (optimize_scaling_factor) {
const int compat_gribex = handle->context->gribex_mode_on && edition_ == 1;
const int compat_32bit = 1;

View File

@ -210,6 +210,18 @@ ${tools_dir}/grib_set -s scaleValuesBy=1.01 $input $temp1
${tools_dir}/grib_dump $temp1
grib_check_key_equals $temp1 packingType grid_second_order
# ECC-1986: GRIB1: Setting field values in second order packing
cat > $tempFilt<<EOF
if (count==1) {
# min = 19074.9, max = 20717.6
assert( min < 20000 );
set offsetValuesBy = 1000.0;
assert( min > 20000 );
}
EOF
input=lfpw.grib1
${tools_dir}/grib_filter $tempFilt $input
# Clean up
rm -f $temp_stat1 $temp_stat2