mirror of https://github.com/ecmwf/eccodes.git
BUFR decoding: print descriptor code in out-of-range error message
This commit is contained in:
parent
2ea8bc3c89
commit
659912dd9c
|
@ -828,14 +828,14 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu
|
||||||
if (*v > maxAllowed || *v < minAllowed) {
|
if (*v > maxAllowed || *v < minAllowed) {
|
||||||
if (dont_fail_if_out_of_range) {
|
if (dont_fail_if_out_of_range) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ECCODES WARNING : encode_double_array: %s. Value (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
"ECCODES WARNING : encode_double_array: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
||||||
" Setting it to missing value\n",
|
" Setting it to missing value\n",
|
||||||
bd->shortName, *v, minAllowed, maxAllowed);
|
bd->shortName, bd->code, *v, minAllowed, maxAllowed);
|
||||||
grib_set_bits_on(buff->data, pos, modifiedWidth);
|
grib_set_bits_on(buff->data, pos, modifiedWidth);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s. Value (%g) out of range (minAllowed=%g, maxAllowed=%g).",
|
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).",
|
||||||
bd->shortName, *v, minAllowed, maxAllowed);
|
bd->shortName, bd->code, *v, minAllowed, maxAllowed);
|
||||||
return GRIB_OUT_OF_RANGE; /* ECC-611 */
|
return GRIB_OUT_OF_RANGE; /* ECC-611 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -890,9 +890,9 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu
|
||||||
/* Turn out-of-range values into 'missing' */
|
/* Turn out-of-range values into 'missing' */
|
||||||
if (*v != GRIB_MISSING_DOUBLE && (*v < minAllowed || *v > maxAllowed)) {
|
if (*v != GRIB_MISSING_DOUBLE && (*v < minAllowed || *v > maxAllowed)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ECCODES WARNING : encode_double_array: %s. Value at index %ld (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
"ECCODES WARNING : encode_double_array: %s (%06d). Value at index %ld (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
||||||
" Setting it to missing value\n",
|
" Setting it to missing value\n",
|
||||||
bd->shortName, (long)ii, *v, minAllowed, maxAllowed);
|
bd->shortName, bd->code, (long)ii, *v, minAllowed, maxAllowed);
|
||||||
*v = GRIB_MISSING_DOUBLE;
|
*v = GRIB_MISSING_DOUBLE;
|
||||||
}
|
}
|
||||||
ii++;
|
ii++;
|
||||||
|
@ -926,13 +926,13 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu
|
||||||
v++;
|
v++;
|
||||||
}
|
}
|
||||||
if (max > maxAllowed && max != GRIB_MISSING_DOUBLE) {
|
if (max > maxAllowed && max != GRIB_MISSING_DOUBLE) {
|
||||||
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s. Maximum value (value[%lu]=%g) out of range (maxAllowed=%g).",
|
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Maximum value (value[%lu]=%g) out of range (maxAllowed=%g).",
|
||||||
bd->shortName, index_of_max, max, maxAllowed);
|
bd->shortName, bd->code, index_of_max, max, maxAllowed);
|
||||||
return GRIB_OUT_OF_RANGE;
|
return GRIB_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
if (min < minAllowed && min != GRIB_MISSING_DOUBLE) {
|
if (min < minAllowed && min != GRIB_MISSING_DOUBLE) {
|
||||||
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s. Minimum value (value[%lu]=%g) out of range (minAllowed=%g).",
|
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_array: %s (%06d). Minimum value (value[%lu]=%g) out of range (minAllowed=%g).",
|
||||||
bd->shortName, index_of_min, min, minAllowed);
|
bd->shortName, bd->code, index_of_min, min, minAllowed);
|
||||||
return GRIB_OUT_OF_RANGE;
|
return GRIB_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,15 +1015,15 @@ static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bu
|
||||||
else if (value > maxAllowed || value < minAllowed) {
|
else if (value > maxAllowed || value < minAllowed) {
|
||||||
if (dont_fail_if_out_of_range) {
|
if (dont_fail_if_out_of_range) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ECCODES WARNING : encode_double_value: %s. Value (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
"ECCODES WARNING : encode_double_value: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g)."
|
||||||
" Setting it to missing value\n",
|
" Setting it to missing value\n",
|
||||||
bd->shortName, value, minAllowed, maxAllowed);
|
bd->shortName, bd->code, value, minAllowed, maxAllowed);
|
||||||
/* Ignore the bad value and instead use 'missing' */
|
/* Ignore the bad value and instead use 'missing' */
|
||||||
grib_set_bits_on(buff->data, pos, modifiedWidth);
|
grib_set_bits_on(buff->data, pos, modifiedWidth);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_value: %s. Value (%g) out of range (minAllowed=%g, maxAllowed=%g).",
|
grib_context_log(c, GRIB_LOG_ERROR, "encode_double_value: %s (%06d). Value (%g) out of range (minAllowed=%g, maxAllowed=%g).",
|
||||||
bd->shortName, value, minAllowed, maxAllowed);
|
bd->shortName, bd->code, value, minAllowed, maxAllowed);
|
||||||
return GRIB_OUT_OF_RANGE;
|
return GRIB_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ ${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile 2>$tempText
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q 'longitude. Maximum value (value\[0\]=500) out of range' $tempText
|
grep -q 'longitude (006001). Maximum value (value\[0\]=500) out of range' $tempText
|
||||||
|
|
||||||
# Now set environment variable to turn out-of-range values into 'missing'
|
# Now set environment variable to turn out-of-range values into 'missing'
|
||||||
export ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE=1
|
export ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE=1
|
||||||
|
|
Loading…
Reference in New Issue