From 2fb5fbbe27e11ea6b8113cd5cb4071783cbc7093 Mon Sep 17 00:00:00 2001 From: shahramn Date: Tue, 30 Jul 2024 12:55:04 +0100 Subject: [PATCH] ECC-1855: Fix step initialisation --- src/accessor/grib_accessor_class_g2end_step.cc | 2 +- tests/grib_sub_hourly.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/accessor/grib_accessor_class_g2end_step.cc b/src/accessor/grib_accessor_class_g2end_step.cc index 6e8cfcda3..94fcbaeaf 100644 --- a/src/accessor/grib_accessor_class_g2end_step.cc +++ b/src/accessor/grib_accessor_class_g2end_step.cc @@ -309,7 +309,7 @@ static int unpack_multiple_time_ranges_double_(grib_accessor* a, double* val, si long the_coded_unit = arr_coded_unit[i]; long the_coded_time_range = arr_coded_time_range[i]; - eccodes::Step time_range{ the_coded_unit, the_coded_time_range }; + eccodes::Step time_range{the_coded_time_range, the_coded_unit}; *val = (start_step + time_range).value(eccodes::Unit(step_units)); return GRIB_SUCCESS; diff --git a/tests/grib_sub_hourly.sh b/tests/grib_sub_hourly.sh index dfbf145f5..b138aa04a 100755 --- a/tests/grib_sub_hourly.sh +++ b/tests/grib_sub_hourly.sh @@ -62,6 +62,11 @@ fi instantaneous_field=$data_dir/reduced_gaussian_surface.grib2 accumulated_field=$data_dir/reduced_gaussian_sub_area.grib2 +# ECC-1855: Bad step initialisation +${tools_dir}/grib_set -s productDefinitionTemplateNumber=11,forecastTime=2184,indicatorOfUnitForForecastTime=1,lengthOfTimeRange=720,indicatorOfUnitForTimeRange=1,typeOfTimeIncrement=2,numberOfTimeRange=2 $accumulated_field $temp +${tools_dir}/grib_ls $temp +grib_check_key_equals $temp "-p stepRange" "2184-2904" + # ECC-1802: Relaxation of the "Step Units Rule": # The updated rule permits the simultaneous assignment of the same step unit to both 'stepUnits' and 'step*' keys in="$instantaneous_field"