A comprehensive, modular Python library for parsing and decoding aviation weather reports (METAR and TAF).
- METAR Decoder: Parse Meteorological Terminal Air Reports
- TAF Decoder: Parse Terminal Aerodrome Forecasts
- Modular Architecture: Clean, maintainable code with specialized parsers
- Command Line Interface: Easy-to-use CLI tools
- Comprehensive Parsing: Handles wind, visibility, weather phenomena, sky conditions, and more
- Remarks Decoding: Intelligent parsing of remarks sections
- Multiple Formats: Support for various international weather report formats
pip install -e .
from weather_decoder import MetarDecoder, TafDecoder
# Decode METAR
metar_decoder = MetarDecoder()
metar_data = metar_decoder.decode("METAR KJFK 061751Z 28008KT 10SM FEW250 22/18 A2992")
print(metar_data)
# Decode TAF
taf_decoder = TafDecoder()
taf_data = taf_decoder.decode("TAF KJFK 061730Z 0618/0724 28008KT 9999 FEW250")
print(taf_data)
# Decode METAR
decode-metar "METAR KJFK 061751Z 28008KT 10SM FEW250 22/18 A2992"
# Decode TAF
decode-taf "TAF KJFK 061730Z 0618/0724 28008KT 9999 FEW250"
# Process files
decode-metar -f metars.txt
decode-taf -f tafs.txt
# Interactive mode
decode-metar
decode-taf
The Weather Decoder 1.0 features a clean, modular architecture:
weather_decoder/
├── core/ # Main decoder classes
├── data/ # Data classes for parsed reports
├── parsers/ # Specialized component parsers
├── utils/ # Constants, patterns, and formatters
└── cli/ # Command line interfaces
- Core Decoders: Orchestrate the parsing process
- Specialized Parsers: Handle specific weather components (wind, visibility, etc.)
- Data Classes: Structured representation of parsed data
- Utilities: Shared constants, patterns, and formatting functions
- CLI: User-friendly command line interfaces
- Maintainability: Each parser handles a specific component
- Testability: Components can be tested in isolation
- Extensibility: Easy to add new parsers or modify existing ones
- Reusability: Parsers can be used independently
- Clarity: Clear separation of concerns
- Station identification
- Observation time
- Wind information (including variable direction and gusts)
- Visibility (including RVR)
- Weather phenomena
- Sky conditions
- Temperature and dewpoint
- Altimeter settings
- Trends
- Comprehensive remarks parsing
- Station identification and issue time
- Valid periods
- Wind forecasts
- Visibility forecasts
- Weather phenomena forecasts
- Sky condition forecasts
- Temperature forecasts (TX/TN)
- Change groups (TEMPO, BECMG, FM, PROB)
- Pressure settings (QNH)
- Remarks parsing
The new modular structure maintains API compatibility while providing better organization:
# Old way (still works)
from weather_decoder import MetarDecoder, TafDecoder
# New way (recommended for advanced usage)
from weather_decoder.core.metar_decoder import MetarDecoder
from weather_decoder.parsers.wind_parser import WindParser
Contributions are welcome! The modular architecture makes it easy to:
- Add new parsers for additional weather components
- Improve existing parsers
- Add support for new weather report formats
- Enhance the CLI tools
MIT License - see LICENSE file for details.