/metar-parser

A Ruby library for METAR weather reports

Primary LanguageRubyMIT LicenseMIT

metar - Downloads and parses weather status

The information comes from the National Oceanic and Atmospheric Association’s raw data source.

Implementation

  • Parses METAR strings using a state machine.

Example

This prints the latest weather report for Portland International Airport:

require ‘rubygems’ require ‘metar’

raw = Metar::Raw.new( ‘KPDX’ ) parser = Metar::Parser.new( raw ) report = Metar::Report.new( parser )

puts report.to_s

Data format descrition

Other software

Other Ruby libraries offering METAR parsing:

There are many reports (WMO) that these libraries do not parse.

There are two gems which read the National Oceanic and Atmospheric Association’s XML weather data feeds:

Interactive map:

Testing

The tests use a local copy of the weather stations list: data/nsd_cccc.txt

If missing, the file gets downloaded before running tests.