ECC-1768: GRIB2: Issue with setting PDTN 8, stepUnits and step at the same time (Initial try)

This commit is contained in:
Shahram Najm 2024-02-19 11:26:59 +00:00
parent 64f3b3c7df
commit 0dc3c273cc
3 changed files with 44 additions and 0 deletions

View File

@ -211,6 +211,11 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
if ((ret = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS)
return ret;
// TODO(maee): A better solution should be found
if (h->loader) { // h->loader is set only when rebuilding or reparsing
force_step_units = 255; // See ECC-1768
}
try {
std::vector<eccodes::Step> steps = parse_range(val, eccodes::Unit{force_step_units});
if (steps.size() == 0) {

View File

@ -351,6 +351,31 @@ set -e
[ $status -ne 0 ]
grep -q "unreadable message" $fLog
###???
f1="aaen_55.bufr"
f2="aaen_55.bufr"
set +e
${tools_dir}/bufr_compare -H -c edition $f1 $f2 > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "options are incompatible" $fLog
set +e
${tools_dir}/bufr_compare -a edition $f1 $f2 > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "a option requires -c option" $fLog
set +e
${tools_dir}/bufr_compare nosuchfile $f1 > $fLog 2>&1
status=$?
set -e
[ $status -ne 0 ]
# Clean up
# -------------

View File

@ -520,6 +520,20 @@ cat $tempFilt
${tools_dir}/grib_filter $tempFilt $data_dir/constant_field.grib2
unset ECCODES_GRIB_HOURLY_STEPS_WITH_UNITS
# Changing the product definition template
# ----------------------------------------
# See ECC-1768
${tools_dir}/grib_set -s step=62m $sample_g2 $temp
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8 $temp $temp2
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8,stepUnits=s,step=0 $sample_g2 $temp
grib_check_key_equals $temp '-p stepUnits:s,startStep,productDefinitionTemplateNumber' 's 0s 8'
${tools_dir}/grib_set -s productDefinitionTemplateNumber=8,stepUnits=m,step=60 $sample_g2 $temp
grib_check_key_equals $temp '-p stepUnits:s,productDefinitionTemplateNumber' 'h 8'
# Bad stepUnits
set +e
${tools_dir}/grib_set -s stepUnits=190 $sample_g2 $temp > $tempText 2>&1