From f4279fc7bc42f53a9f4846e68f4665cc64e37cf8 Mon Sep 17 00:00:00 2001 From: shahramn Date: Tue, 26 Nov 2024 10:03:22 +0000 Subject: [PATCH] ECC-1986: GRIB1: Setting field values in second order packing --- ...s_data_g1second_order_general_extended_packing.cc | 5 +++-- tests/grib_second_order.sh | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc index 2ee15e425..166be66de 100644 --- a/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -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; diff --git a/tests/grib_second_order.sh b/tests/grib_second_order.sh index 0d44a87cb..241f4af7c 100755 --- a/tests/grib_second_order.sh +++ b/tests/grib_second_order.sh @@ -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< 20000 ); + } +EOF +input=lfpw.grib1 +${tools_dir}/grib_filter $tempFilt $input + # Clean up rm -f $temp_stat1 $temp_stat2