ECC-1322: grib_compare: Option '-e' generates dubious error message

This commit is contained in:
Shahram Najm 2022-01-11 15:24:44 +00:00
parent ec4b6969ee
commit 557b92cacb
3 changed files with 35 additions and 2 deletions

View File

@ -90,6 +90,7 @@ if( HAVE_BUILD_TOOLS )
grib_ecc-1260
grib_ecc-1261
grib_ecc-1271
grib_ecc-1322
grib_ecc-1319
bufr_ecc-1028
bufr_ecc-1195

28
tests/grib_ecc-1322.sh Executable file
View File

@ -0,0 +1,28 @@
#!/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.sh
set -u
REDIRECT=/dev/null
label="grib_ecc-1322_test"
tempGrb=temp.$label.grib
tempOut=temp.$label.out
tempRef=temp.$label.ref
sample_grib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
${tools_dir}/grib_set -s edition=2 $sample_grib1 $tempGrb
${tools_dir}/grib_compare -e -b param $sample_grib1 $tempGrb > $tempOut 2>&1
[ ! -s "$tempOut" ]
# Clean up
rm -f $tempGrb $tempOut $tempRef

View File

@ -82,7 +82,8 @@ static int onlyListed = 1;
static int headerMode = 0;
static int morein1 = 0;
static int morein2 = 0;
static int listFromCommandLine;
static int listFromCommandLine = 0;
static int editionIndependent = 0;
static int verbose = 0;
static double tolerance_factor = 1;
@ -216,6 +217,9 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("c:") || grib_options_on("e"))
listFromCommandLine = 1;
if (grib_options_on("e"))
editionIndependent = 1;
if (grib_options_on("a"))
onlyListed = 0;
else
@ -1194,7 +1198,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
err++;
}
grib_keys_iterator_delete(iter);
if (num_keys_in_namespace == 0) {
if (num_keys_in_namespace == 0 && !editionIndependent) {
printf("ERROR: namespace \"%s\" does not contain any key.\n", options->compare[i].name);
}
}