Skip to content

Commit 6f38dee

Browse files
committed
Fix BMISS handling and separate GSI-structural checks from diagnostics in check_prepbufr
Fixes false bad_units errors caused by treating BUFR BMISS as real values. Separates GSI-minimum structural validation from diagnostic checks, aligning checker behavior with GSI and BUFRLIB. Real physical/unit issues are now correctly flagged only when applicable.
1 parent 7e51bfb commit 6f38dee

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/check_prepbufr.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@
111111
LAT_RANGE_STRUCT = (-90.0, 90.0)
112112

113113
# Missing típico da BUFRLIB
114-
BUFR_MISSING = 1.0e10
114+
try:
115+
BUFR_MISSING = float(ncepbufr.bufrlib.getbmiss())
116+
except Exception:
117+
BUFR_MISSING = 1.0e10
115118

116119
# Tipos de falha (para report-csv)
117120
FAIL_GSI_HDR = "gsi_bad_header"
@@ -553,6 +556,10 @@ def inc(d: Dict[object, int], k: object, by: int = 1):
553556

554557
def check_range(name: str) -> bool:
555558
a = _read_scalar(read, name)
559+
560+
# Missing não é erro de unidade
561+
if _is_missing(a):
562+
return True
556563
if name in ("POB", "PRSS") and a is not None:
557564
a = a * pscale
558565
lo, hi = RANGE[name]

0 commit comments

Comments
 (0)