Giter Club home page Giter Club logo

metar-parser's Introduction

metar-parser Build Status

Get latest weather reports from weather stations worldwide

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

Usage

require 'rubygems' if RUBY_VERSION < '1.9'
require 'metar'

Examples

Hello World

This prints the latest weather report for Portland International Airport:

station = Metar::Station.find_by_cccc('KPDX')
puts station.report.to_s

Countries

List countries:

puts Metar::Station.countries

Find a country's weather stations:

spanish = Metar::Station.find_all_by_country('Spain')

Get The Data

station = Metar::Station.find_by_cccc('KPDX')
parser  = station.parser
puts parser.temperature.value

Use Your Own Raw Data

metar_string = "KHWD 280554Z AUTO 29007KT 10SM OVC008 14/12 A3002 RMK AO2 SLP176 T01390117 10211\n"
raw    = Metar::Raw::Data.new(metar_string)
parser = Metar::Parser.new(raw)

Translations

Translations are available for the following languages (and region):

  • :de
  • :en
  • :'en-US'
  • :it
  • :'pt-BR'

Thanks to the I18n gem's fallback mechanism, under regional locales, language generic translations will be used if a region-specific translation is not available. I.e.

I18n.locale = :'en-US'
I18n.t('metar.station_code.title') # station code

Compliance

By default, the parser runs in 'loose' compliance mode. That means that it tries to accept non-standard input.

If you only want to accept standards-compliant METAR strings, do this:

Metar::Parse.compliance = :strict

Changelog

1.0.0

This version introduces a major change to the Metar::Raw class.

Previously, this class downloaded METAR data from the NOAA FTP site. The old functionality has been moved to Metar::Raw::Noaa. The new class, Metar::Raw::Data accepts a METAR string as a parameter - allowing the user to parse METAR strings without necessarily contacting the NOAA.

Contributors

Alternative Software

Ruby

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:

Other

metar-parser's People

Contributors

drmwndr avatar epicdraws avatar joeyates avatar math avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.