Skip to content

NEXRAD level2: get_ldm drops trailing Message 31 radials from LDM records containing Message 2 #389

Description

@aladinor

Summary

NEXRADLevel2File.get_ldm locates messages with fixed // 120 / % 120 arithmetic, assuming every LDM compressed record holds exactly 120 messages. Records that carry Message 2 (RDA status) slots still contain 120 Message 31 radials, but at shifted positions — the fixed arithmetic drops the trailing radials of those records, so affected sweeps come back short.

MRE (public file)

import fsspec
from xradar.io.backends.nexrad_level2 import open_nexradlevel2_datatree

url = "s3://unidata-nexrad-level2/2026/03/10/KLOT/KLOT20260310_231412_V06"
with fsspec.open(f"simplecache::{url}", s3={"anon": True}) as f:
    local = f.name

tree = open_nexradlevel2_datatree(local)
print(tree["sweep_4"].ds.sizes["azimuth"])  # 717

Expected

720 rays. An independent byte-level census (walking each decompressed LDM record message-by-message via the size_halfwords/message-type headers, skipping the fixed 2432-byte slots of non-31 messages) finds 720 Message 31 radials in this cut; the 3 missing rays are the trailing radials of the Message-2-carrying record.

Suggested fix

Walk messages by their headers instead of assuming 120 messages/record — non-31 messages occupy fixed 2432-byte slots and can appear at arbitrary positions.

xradar 0.12.1.dev9+gd723857f2 (main), Python 3.12.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions