GRIB2 product template selection: Error messages

This commit is contained in:
shahramn 2024-10-20 14:45:50 +01:00
parent 9736f663dc
commit 159795c71a
1 changed files with 4 additions and 9 deletions

View File

@ -298,10 +298,8 @@ static int grib_concept_apply(grib_accessor* a, const char* name)
size_t i = 0, concept_count = 0; size_t i = 0, concept_count = 0;
long dummy = 0, editionNumber = 0; long dummy = 0, editionNumber = 0;
char centre_s[32] = {0,}; char centre_s[32] = {0,};
size_t centre_len = sizeof(centre_s); size_t centre_len = sizeof(centre_s);
char* all_concept_vals[MAX_NUM_CONCEPT_VALUES] = { char* all_concept_vals[MAX_NUM_CONCEPT_VALUES] = {NULL,}; /* sorted array containing concept values */
NULL,
}; /* sorted array containing concept values */
grib_concept_value* pCon = concepts; grib_concept_value* pCon = concepts;
grib_context_log(h->context, GRIB_LOG_ERROR, "concept: no match for %s=%s", act->name, name); grib_context_log(h->context, GRIB_LOG_ERROR, "concept: no match for %s=%s", act->name, name);
@ -374,7 +372,6 @@ static int grib_concept_apply(grib_accessor* a, const char* name)
err = grib_set_values_silent(h, values, count, /*silent=*/1); err = grib_set_values_silent(h, values, count, /*silent=*/1);
if (err) { if (err) {
// GRIB2 product template selection // GRIB2 product template selection
bool resubmit = false;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (values[i].error == GRIB_NOT_FOUND) { if (values[i].error == GRIB_NOT_FOUND) {
// Repair the most common cause of failure: input GRIB handle // Repair the most common cause of failure: input GRIB handle
@ -382,7 +379,6 @@ static int grib_concept_apply(grib_accessor* a, const char* name)
if (STR_EQUAL(values[i].name, "typeOfStatisticalProcessing")) { if (STR_EQUAL(values[i].name, "typeOfStatisticalProcessing")) {
// Switch from instantaneous to interval-based // Switch from instantaneous to interval-based
if (grib_set_long(h, "selectStepTemplateInterval", 1) == GRIB_SUCCESS) { if (grib_set_long(h, "selectStepTemplateInterval", 1) == GRIB_SUCCESS) {
resubmit = true;
grib_set_values(h, &values[i], 1); grib_set_values(h, &values[i], 1);
} }
} }
@ -393,9 +389,8 @@ static int grib_concept_apply(grib_accessor* a, const char* name)
// } // }
} }
} }
if (resubmit) {
err = grib_set_values(h, values, count); err = grib_set_values(h, values, count);
}
} }
} }
return err; return err;