Skip to main content

A regex-based parser for ATIS, METAR, and TAF aviation weather reports

Project description

ATIS Parser

A Python package for parsing ATIS, METAR, and TAF aviation weather reports using regex-based parsing. This package converts raw aviation weather text into structured Pydantic models for easy programmatic access.

Features

  • ATIS Parser: Parses Arrival and Departure ATIS reports (supports both North American and European formats)
  • METAR Parser: Parses METAR (Meteorological Aerodrome Report) observations
  • TAF Parser: Parses TAF (Terminal Aerodrome Forecast) forecasts
  • Structured Output: Returns Pydantic models for type safety and validation
  • Comprehensive Parsing: Extracts wind, visibility, temperature, cloud layers, runway conditions, and more
  • Format Support: Handles both North American (CYYZ) and European (ENGM) ATIS formats
  • Helper Methods: Built-in .to_json() and .to_dict() methods for easy serialization
  • Smart Runway Detection: Automatically detects arrival and departure runways from various format patterns

Installation

pip install atis-parser

Or install from source:

git clone https://github.com/planesfyi/atis_parser.git
cd atis-parser
pip install -e .

Usage

ATIS Parsing

from atis_parser import parse_atis

atis_text = """
Arrival ATIS
2026-01-05 13:29 UTC
CYYZ ARR ATIS O
1326Z CYYZ ARR ATIS O
1326Z 16008KT 1/2SM SN
VV005 M03/M04 A2993 APCH
ILS RWY 15L. LDG RWY 15L
DEP RWY 15R. RSC 15R
5/5/5 30 PCT 1/8IN DRY
SNOW, 30 PCT 1/8IN DRY
SNOW, 30 PCT 1/8IN DRY
SNOW. 160FT WIDTH.
"""

result = parse_atis(atis_text)
print(result.wind_direction)  # 160
print(result.wind_speed)      # 8
print(result.visibility)     # 1 (for 1/2SM, rounded up)
print(result.temperature)    # -3
print(result.dewpoint)        # -4
print(result.runways)         # List of RunwayInfo objects
print(result.runway_condition)  # Dict of RunwaySurfaceConditionData

# Convert to JSON or dictionary
json_output = result.to_json()  # Returns formatted JSON string
data_dict = result.to_dict()    # Returns Python dictionary

METAR Parsing

from atis_parser import parse_metar

metar_text = "SPECI CYYZ 051326Z 15008KT 1/2SM R15L/4000V5500FT/D R24L/4500VP6000FT/D R24R/5000VP6000FT/D R23/4000V5500FT/N SN VV005 M03/M04 A2993 RMK SN8 SLP147"

result = parse_metar(metar_text)
print(result.station)         # "CYYZ"
print(result.wind_direction)  # 150
print(result.wind_speed)      # 8
print(result.visibility)     # 0.5
print(result.temperature)    # -3
print(result.dewpoint)        # -4
print(result.cloud_layers)   # List of CloudLayer objects

TAF Parsing

from atis_parser import parse_taf

taf_text = """
TAF AMD CYYZ 051239Z 0512/0618 16010KT 1/2SM SN VV004
TEMPO 0512/0514 2SM -SN OVC010
FM051400 16010KT 1SM -SN BR OVC005
"""

result = parse_taf(taf_text)
print(result.station)         # "CYYZ"
print(result.issue_time)      # "051239Z"
print(result.valid_period)    # "0512/0618"
print(result.forecasts)       # List of TafForecastGroup objects

Format Support

The parser supports both North American and European ATIS formats:

North American Format (e.g., CYYZ)

  • Standard wind format: 16008KT
  • Temperature format: M03/M04 (negative temperatures)
  • Altimeter: A2993
  • Runway patterns: ILS RWY 15L, LDG RWY 15L, DEP RWY 15R

European Format (e.g., ENGM)

  • Runway-specific wind: RWY01R WIND 040/5KT
  • Temperature format: TMS9 DPMS12 (Temperature Minus 9, Dewpoint Minus 12)
  • Altimeter: QNH 1013HPA
  • Visibility: VIS 10KM or VIS TDZ 2300M MID 2700M END 2400M
  • Arrival runways: EXP ILS OR RNP APCH RWY01R
  • Departure runways: RWY01L IN USE (in departure ATIS)

Data Models

All models include .to_json(indent=2) and .to_dict() helper methods for easy serialization.

AtisParsedData

  • wind_direction: Wind direction in degrees (0-360)
  • wind_speed: Wind speed in knots
  • visibility: Visibility in statute miles (rounded up for fractional values)
  • temperature: Temperature in Celsius
  • dewpoint: Dewpoint in Celsius
  • runway_condition: Dictionary of runway surface conditions keyed by runway name
  • cloud_layers: List of cloud layer information
  • runways: List of runway information with approach/departure status
  • notams: List of NOTAMs
  • remarks: Additional remarks
  • .to_json(indent=2): Convert to JSON string
  • .to_dict(): Convert to Python dictionary

MetarParsedData

  • station: ICAO station identifier
  • report_type: Report type (METAR, SPECI)
  • time: Observation time
  • wind_direction, wind_speed, wind_gust: Wind information
  • visibility: Visibility in statute miles (supports both SM and meter-based formats)
  • runway_visual_range: Dictionary of RVR data
  • weather_phenomena: List of weather codes
  • cloud_layers: List of cloud layers
  • temperature, dewpoint: Temperature information
  • altimeter: Altimeter setting
  • remarks: Remarks section
  • .to_json(indent=2): Convert to JSON string
  • .to_dict(): Convert to Python dictionary

TafParsedData

  • station: ICAO station identifier
  • report_type: Report type (TAF, TAF AMD)
  • issue_time: Issue time
  • valid_period: Valid period
  • forecasts: List of forecast groups with modifiers (TEMPO, BECMG, FM, PROB30, PROB40, etc.)
  • remarks: Remarks section
  • .to_json(indent=2): Convert to JSON string
  • .to_dict(): Convert to Python dictionary

Development

Running Tests

make test

Tests run automatically on push and pull requests via GitHub Actions.

Building and Publishing

The package is automatically published to PyPI when a GitHub release is created. See .github/workflows/README.md for setup instructions.

Requirements

  • Python 3.8+
  • pydantic >= 2.0.0

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atis_parser-0.0.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atis_parser-0.0.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file atis_parser-0.0.1.tar.gz.

File metadata

  • Download URL: atis_parser-0.0.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for atis_parser-0.0.1.tar.gz
Algorithm Hash digest
SHA256 023076a36e9454615261c7cf401dc55b2207778e957eb985e42e9a3b203ba1be
MD5 bcfc369f69b6f948673f55c4c5b95b4a
BLAKE2b-256 95a0566e83e0f2a14ac9ec6c566d93e82cbfbc1d1c60ac52c47d249def4e884d

See more details on using hashes here.

File details

Details for the file atis_parser-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: atis_parser-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for atis_parser-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84e1b4844481e054b601a8baaa3210316f36c4d6353f643f4523716343123536
MD5 47d0ba9da100ff6cd64ca51c6506d22b
BLAKE2b-256 1f54ac794ed194b0db9a8e7cd77d2efdad21d6fbfe093175dcc156a1ad58ab41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page