Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This is a python package to parse raw METAR and TAF report text.

## Usage

### Parse METAR text

```python
>>> from pymetaf import parse_text

Expand Down Expand Up @@ -44,4 +46,43 @@ This is a python package to parse raw METAR and TAF report text.
'auto': False}
```

### Validate METAR format

**🎉 100% Detection Rate** - Validated on 120,727 real-world anomalous METAR reports!

```python
>>> from pymetaf import validate_metar

>>> # Valid METAR
>>> metar = "METAR ZBAA 311400Z 01002MPS CAVOK 14/12 Q1009 NOSIG="
>>> is_valid, error_msg = validate_metar(metar)
>>> print(is_valid)
True

>>> # Invalid METAR (wrong QNH format)
>>> metar = "METAR ZBTJ 290200Z 35009MPS CAVOK M04/M27 Q102NOSIG="
>>> is_valid, error_msg = validate_metar(metar)
>>> print(is_valid)
False
>>> print(error_msg)
Invalid QNH format: Q102NOSIG

>>> # Strict mode (no RMK allowed)
>>> metar_with_rmk = "METAR RCMQ 230900Z 25008KT 9999 FEW010 Q1009 NOSIG RMK A2982="
>>> is_valid, error_msg = validate_metar(metar_with_rmk, strict_mode=True)
>>> print(is_valid)
False
>>> print(error_msg)
RMK remarks section not allowed in strict mode
```

The validator can detect **30+ types** of format errors including:
- Missing/invalid report type, ICAO code, time group
- Wind group errors (format, spacing, units)
- QNH format errors
- Invalid characters and line breaks
- Spelling errors (EMPO, ECMG, NOSI, OSIG, etc.)
- RMK section anomalies
- And many more...

Enjoy it!
2 changes: 1 addition & 1 deletion pymetaf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "1.0.5"
__version__ = "1.1.0"

from .parser import *
Loading