Skip to content

Enable parsing of METARs that list sea level pressure after the altimeter setting rather than in the remarks.#150

Merged
akrherz merged 2 commits intopython-metar:masterfrom
jhaiduce:issue-148-slp-outside-remarks
Oct 5, 2021
Merged

Enable parsing of METARs that list sea level pressure after the altimeter setting rather than in the remarks.#150
akrherz merged 2 commits intopython-metar:masterfrom
jhaiduce:issue-148-slp-outside-remarks

Conversation

@jhaiduce
Copy link
Contributor

Although sea level pressure (SLP) groups are normally found in the remarks section, in rare cases the SLP group can be found after the altimeter setting. This PR allows enables parsing of METARs that are structured in this way.

Fixes #148.

Copy link
Collaborator

@akrherz akrherz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems harmless to me, but am looking for other's comments.

@tomp
Copy link
Member

tomp commented Sep 23, 2021

I don't think this would break anything. That said, I be reluctant make a change like this to fix a single instance. Are there other stations submitting reports with SLP treated like this? We already have many exceptions for various types of non-conforming METAR reports in this module, but generally I'd only consider doing that if the error was reasonably common.

@jhaiduce
Copy link
Contributor Author

Are there other stations submitting reports with SLP treated like this?

I've only encountered one METAR with this structure.

@tomp
Copy link
Member

tomp commented Sep 24, 2021

I think it's probably fine to merge this, because it should be easy for later maintainers to understand how and why this was done.

If I were still working with this kind of data, I'd be tempted to add a "strict mode", that would accept only METAR that followed the WMO or US spec. If nothing else, it would be a way of documenting - in the code - what changes were made to accommodate non-conforming reports, in case any of those ever cause problems.

@jhaiduce
Copy link
Contributor Author

If I were still working with this kind of data, I'd be tempted to add a "strict mode", that would accept only METAR that followed the WMO or US spec. If nothing else, it would be a way of documenting - in the code - what changes were made to accommodate non-conforming reports, in case any of those ever cause problems.

There already is a "strict" argument passed Metar.Metar constructor. But currently it just changes the error handling behavior (whether to throw exceptions or issue warnings). How much the parser tolerates deviations from the spec(s) should probably be handled with a separate option.

@tomp
Copy link
Member

tomp commented Sep 25, 2021

Sure. In any case, to create what I was suggesting, I think you'd need to create a "strict" version of the group regex's and group-regex list. Most of the other accommodations for non-conforming METAR were made in those regex's. I can't imagine anyone's going to want to do that, anytime soon.

@akrherz akrherz merged commit ddacf5e into python-metar:master Oct 5, 2021
@akrherz akrherz added this to the 1.9 milestone Dec 31, 2021
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.

Unparsed group 'SLP162' when SLP group placed ahead of remarks group.

3 participants