From 9b49125133a6a2dfbe5faa61e79a53824f0b5219 Mon Sep 17 00:00:00 2001 From: shahramn Date: Tue, 15 Oct 2024 17:54:45 +0100 Subject: [PATCH] ECC-1941: GRIB: Setting paramId=131060 fails if typeOfFirstFixedSurface=255 --- definitions/grib2/typeOfLevelConcept.def | 2 +- tests/CMakeLists.txt | 1 + tests/grib_ecc-1941.sh | 34 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 tests/grib_ecc-1941.sh diff --git a/definitions/grib2/typeOfLevelConcept.def b/definitions/grib2/typeOfLevelConcept.def index 946b0722d..34ee22bda 100644 --- a/definitions/grib2/typeOfLevelConcept.def +++ b/definitions/grib2/typeOfLevelConcept.def @@ -98,4 +98,4 @@ 'road' = {typeOfFirstFixedSurface=187; typeOfSecondFixedSurface=255;} 'roadLayer' = {typeOfFirstFixedSurface=187; typeOfSecondFixedSurface=187;} 'urbanCanyon' = {typeOfFirstFixedSurface=187; typeOfSecondFixedSurface=185;} -'unknown' = {dummy=0;} +'unknown' = {dummyc=0;} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1bca272ab..b14566ea2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -277,6 +277,7 @@ if( HAVE_BUILD_TOOLS ) grib_ecc-1792 grib_ecc-1806 grib_ecc-1907 + grib_ecc-1941 grib_modelName grib_sub_hourly grib_set_bytes diff --git a/tests/grib_ecc-1941.sh b/tests/grib_ecc-1941.sh new file mode 100755 index 000000000..e4fd8d417 --- /dev/null +++ b/tests/grib_ecc-1941.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +. ./include.ctest.sh + +# ------------------------------------------------------------ +# This is the test for the JIRA issue ECC-1941 +# Setting paramId=131060 fails if typeOfFirstFixedSurface=255 +# ------------------------------------------------------------ + +label="grib_ecc-1941_test" +tempGribA=temp.$label.A.grib +tempGribB=temp.$label.B.grib + +sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +${tools_dir}/grib_set -s paramId=131060 $sample_grib2 $tempGribA +grib_check_key_equals $tempGribA paramId,shortName '131060 tpg1' + +${tools_dir}/grib_set -s typeOfFirstFixedSurface=255 $sample_grib2 $tempGribA +grib_check_key_equals $tempGribA typeOfLevel unknown + +${tools_dir}/grib_set -s paramId=131060 $tempGribA $tempGribB +grib_check_key_equals $tempGribB paramId,shortName '131060 tpg1' + +# Clean up +rm -f $tempGribA $tempGribB