Skip to content

BUG: Keep altimeter when METAR temperature group is ///// (Fixes #4217) - #4218

Open
CharlesXmf wants to merge 1 commit into
Unidata:mainfrom
CharlesXmf:cursor/fix-metar-missing-temp-group-4217-9171
Open

CharlesXmf wants to merge 1 commit into
Unidata:mainfrom
CharlesXmf:cursor/fix-metar-missing-temp-group-4217-9171

Conversation

@CharlesXmf

Copy link
Copy Markdown

Fixes #4217.

A temperature/dewpoint group of exactly ///// was partially consumed by present weather (//) and never reached the altimeter. parse_metar then returned nan for altimeter even when Q/A was present. Only temperature and dewpoint should be missing.

The grammar in tools/metar_parser/metar_parser.peg now skips weather and cloud matches for a complete ///// group, then the Canopy parser is regenerated (canopy metar_parser.peg --lang python --output ../../src/metpy/io/_metar_parser from tools/metar_parser, Canopy 0.4.1).

Verified with pytest tests/io/test_metar.py (44 passed), including the AWC examples:

  • SKUC 290500Z AUTO VRB01KT CAVOK ///// Q1012 → altimeter 29.88 inHg (1012 hPa); temp/dewpoint missing
  • EGLL 010000Z AUTO 00000KT 2000 ///// Q1013 → altimeter 29.91 inHg (1013 hPa); temp/dewpoint missing

The same reports with 24/20 / 15/10 still parse the altimeter. The bulk METAR file now finds 3 more altimeters from the same pattern.

…ata#4217)

Present weather accepted "//" at the start of a missing
temperature/dewpoint group ("/////"), so later groups including the
altimeter were lost. Prevent weather and cloud rules from matching that
exact group and regenerate the Canopy parser.

Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
@CharlesXmf
CharlesXmf requested a review from a team as a code owner November 23, 2026 03:13
@CharlesXmf
CharlesXmf requested review from dcamron and removed request for a team November 23, 2026 03:13
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

address1 = FAILURE
if address1 is not FAILURE:
elements0.append(address1)
address3 = FAILURE
self._expected.append(('METAR::missing_td', '"/////"'))
if address3 is not FAILURE:
elements0.append(address3)
address4 = FAILURE
return cached[0]
index1 = self._offset
index2, elements0 = self._offset, []
address1 = FAILURE
address1 = FAILURE
if address1 is not FAILURE:
elements0.append(address1)
address2 = FAILURE
while True:
index3, elements1 = self._offset, []
index2, elements0 = self._offset, []
address1 = FAILURE
index4, elements1, address3 = self._offset, [], None
while True:
index5, elements2 = self._offset, []
address4 = FAILURE
address4 = self._read_sep()
if address4 is not FAILURE:
elements2.append(address4)
address5 = FAILURE

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.

Loss of the following altimeter in parse_metar due to the missing temperature group /////

4 participants