8000 Parser allows invalid format of temperature group · Issue #136 · python-metar/python-metar · GitHub
[go: up one dir, main page]

Skip to content

Parser allows invalid format of temperature group #136

@sfo

Description

@sfo

The regex for the temperature group allows an arbitrary number (but at least 1) of digits, both for temperature and dewpoint:

TEMP_RE = re.compile(
r"""^(?P<temp>(M|-)?\d+|//|XX|MM)/
(?P<dewpt>(M|-)?\d+|//|XX|MM)?\s+""",
re.VERBOSE,

However, the Manual on Codes gives the format of the temperature group as T'T'/T'dT'd in 15.11, calling for exactly 2 digits.

Consequently, the following report should raise an error instead of parsing a temperature of 201°C (which clearly is a typo in this context considering the reports before/after this one).

METAR EDDM 022150Z 26006KT CAVOK 201/16 Q1018 NOSIG

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0