python-metar’s documentation

Build Status Test Coverage Documentation Status

python-metar is a library suited to parsing weather data in the METAR format. METAR is kind of a mess and not very human-readable. Hopefully this makes things a bit easier. What appears to be an official spec on the format can be found here.

Basic History

Tom Pollard originally wrote python-metar to parse weather hourly reports as they were posted to the web. That basic functionality still exists in this fork. Building on top of his original work, this fork aims to provide convenient classes methods and to download data in bulk from various sources, store in them nice data structures, and easily make usefule visualizations of that data.

You can download my fork of the repoository from Github.

Dependencies

  • Python 2.7 or 3.3 (might work on 3.4)
  • six for Python 2.7, 3.3 interoperability
  • pip for installation
  • recent versions of pandas, matplotlib
  • requests for hitting the NOAA web API
  • ipython-notebook for running examples (optional)
  • nose and coverage for testing (both optional)
  • sphinx to build the documentation (optional)

If you’re using environments managed through conda (recommended), this will get you started:

conda create --name=metar python=3.3 ipython-notebook pip nose pandas matplotlib six requests coverage

Followed by:

source activate metar # (omit "source" on Windows)

Installation

  • Activate your conda environment;
  • Clone my fork from Github;
  • Change to that resulting directory;
  • Install via pip; and
  • Back out of that directory to use
source activate metar # (omit "source" on Windows)
git clone https://github.com/phobson/python-metar
cd python-metar
pip install .
cd ../..

Testing

Tests are run via nose. Run them all with:

source activate metar # (omit "source" on Windows)
python -c "import metar; metar.test()"

You can get fancy with:

python -c "import metar; metar.test(verbose=2, packageinfo=True, coverage=True)"

Indices and tables