Skip to content

ENH: Decode NEXRAD Level 2 message types 4 and 29 - #4151

Open
thaliamontreux wants to merge 1 commit into
Unidata:mainfrom
thaliamontreux:nexrad-msg4-29
Open

thaliamontreux wants to merge 1 commit into
Unidata:mainfrom
thaliamontreux:nexrad-msg4-29

Conversation

@thaliamontreux

Copy link
Copy Markdown

Follow-up to #4147. Closes #95.

Adds decoding for two more RDA->RPG message types in Level2File:

Message 4 — RDA console message

Operator-facing console text per ICD 2620002 Table VI (u16 length + ASCII). Decoded into console_msgs; non-printable bodies are ignored.

Message 29 — metadata / model data

The long-undocumented type from #95. Found both inline in volumes (the existing KICX_20170712_1458 test file carries one — its Unknown message: 29 warning is now a decode) and as the sole record in _MDM sidecar files.

The body is a product header + product description block (ICD 2620001) followed by a BZIP2-compressed symbology block holding an XDR-serialized grid component per Appendix E. Decoded into model_data — in practice this is the 'Environmental Gridded Data' product: model fields (geopotential height, temperature, RH, U/V wind, pressure) on a 60x60 Lambert-conformal grid surrounding the radar, with self-describing attributes (projection, model name/run/valid times, corner coordinates).

Implementation notes:

  • Supports the size_hw == 0xFFFF convention where the segment fields carry the total record size (ICD 2620002P) — used by standalone _MDM files — plus normal segmented records via _buffer_segment.
  • Includes a small XDR (RFC 4506) reader since xdrlib was removed in Python 3.13 (PEP 594).
  • Malformed/truncated records degrade to a skipped message rather than an exception.

Validated against a real KLSX20261008_205554_V06_MDM file (166 grids across 34 pressure levels, 6 parameters) and synthetic unit tests for both messages (framed/segmented/malformed).

@thaliamontreux
thaliamontreux requested a review from a team as a code owner October 8, 2026 22:25
@thaliamontreux
thaliamontreux requested review from dcamron and removed request for a team October 8, 2026 22:25
@CLAassistant

CLAassistant commented Oct 8, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread tests/io/test_nexrad.py

def test_level2_msg29_inline():
"""Check that an inline message 29 decodes to environmental grids."""
f = Level2File(get_test_data('KICX_20170712_1458', as_file_obj=False))
@thaliamontreux
thaliamontreux force-pushed the nexrad-msg4-29 branch 2 times, most recently from 1285036 to 7e72147 Compare October 9, 2026 00:24
Add support for two more RDA->RPG message types in Level2File:

* Message 4 (console message): operator-facing RDA console text per
  ICD 2620002 Table VI. Decoded into `console_msgs`, ignoring
  non-printable content.
* Message 29 (metadata/model data): found both inline in volumes
  (e.g. KICX_20170712) and as the sole record in `_MDM` sidecar files.
  The body is a product header + description block (ICD 2620001)
  followed by a BZIP2-compressed symbology block holding an
  XDR-serialized grid component (Appendix E). Decoded into
  `model_data` as the 'Environmental Gridded Data' product: model
  fields (geopotential height, temperature, humidity, U/V wind) on a
  Lambert-conformal grid surrounding the radar, with self-describing
  attributes (projection, model name/run/valid times, bounds).
  Supports the size_hw==0xFFFF convention where the segment fields
  carry the total record size (ICD 2620002P), used by the standalone
  _MDM files. A small XDR reader replaces xdrlib, which was removed
  from the stdlib in Python 3.13 (PEP 594).

Validated against a real KLSX _MDM file (166 grids across 34 pressure
levels) and the existing KICX_20170712_1458 test volume, whose inline
message 29 now decodes instead of warning.

Closes Unidata#95.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update NEXRAD parser

3 participants