From 6464d55261e3899cfb721d230a0f475643de8b20 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 13 Oct 2021 17:22:15 +0100 Subject: [PATCH] Better error message when concept match fails --- src/grib_accessor_class_concept.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/grib_accessor_class_concept.c b/src/grib_accessor_class_concept.c index d60a3b815..605dc1317 100644 --- a/src/grib_accessor_class_concept.c +++ b/src/grib_accessor_class_concept.c @@ -357,10 +357,16 @@ static int grib_concept_apply(grib_accessor* a, const char* name) if (err) { size_t i = 0, concept_count = 0; long dummy = 0, editionNumber = 0; + char centre_s[32] = {0,}; + size_t centre_len = sizeof(centre_s); char* all_concept_vals[MAX_NUM_CONCEPT_VALUES] = {NULL,}; /* sorted array containing concept values */ grib_concept_value* pCon = concepts; grib_context_log(h->context, GRIB_LOG_ERROR, "concept: no match for %s=%s", act->name, name); + if (grib_get_long(h, "edition", &editionNumber) == GRIB_SUCCESS && + grib_get_string(h, "centre", centre_s, ¢re_len) == GRIB_SUCCESS) { + grib_context_log(h->context, GRIB_LOG_ERROR, "concept: input handle edition=%ld, centre=%s", editionNumber, centre_s); + } if (strcmp(act->name, "paramId") == 0 && string_to_long(name, &dummy) == GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "Please check the Parameter Database 'https://apps.ecmwf.int/codes/grib/param-db/?id=%s'", name); @@ -369,9 +375,6 @@ static int grib_concept_apply(grib_accessor* a, const char* name) grib_context_log(h->context, GRIB_LOG_ERROR, "Please check the Parameter Database 'https://apps.ecmwf.int/codes/grib/param-db/'"); } - if (grib_get_long(h, "edition", &editionNumber) == GRIB_SUCCESS) { - grib_context_log(h->context, GRIB_LOG_ERROR, "concept: input handle edition=%ld", editionNumber); - } /* Create a list of all possible values for this concept and sort it */ while (pCon) {