mirror of https://github.com/ecmwf/eccodes.git
GRIB2 product template selection: fix test
This commit is contained in:
parent
5e37c3e754
commit
11c571d5c2
|
@ -377,6 +377,7 @@ 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
|
||||||
|
@ -384,6 +385,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,9 +397,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,15 @@ grib_check_key_equals $tempGribA productDefinitionTemplateNumber 8
|
||||||
grib_check_key_equals $tempGribA typeOfStatisticalProcessing,stepType '2 max'
|
grib_check_key_equals $tempGribA typeOfStatisticalProcessing,stepType '2 max'
|
||||||
grib_check_key_equals $tempGribA shortName,name 'max_visp Time-maximum visibility through precipitation'
|
grib_check_key_equals $tempGribA shortName,name 'max_visp Time-maximum visibility through precipitation'
|
||||||
|
|
||||||
|
# Test a failure. paramId=140114 contains wave keys
|
||||||
|
set +e
|
||||||
|
$tools_dir/grib_set -s paramId=140114 $sample_g2 $tempGribA 2>$tempText
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
# cat $tempText
|
||||||
|
# check for "typeOfWavePeriodInterval (type=long) failed: Key/value not found" in error log
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $tempText $tempGribA $tempGribB
|
rm -f $tempText $tempGribA $tempGribB
|
||||||
|
|
Loading…
Reference in New Issue