Skip to content

jelson/metar_calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

METAR Predictor

A web application and command-line tool that predicts hourly airport weather conditions based on historical METAR data patterns. Perfect for pilots who want to get a sense for weather patterns at unfamiliar airports.

Live demo: https://www.avmapper.com/metars

Why?

Have you ever planned a flight into a coastal airport and wondered, "What time will this marine layer burn off if I fly in next week?" TAFs only go out a day or two in advance. If you're planning an itinerary for next week or next month, it's hard to know what to expect.

This predictor solves that problem by analyzing several years of historical METAR data to show you typical weather patterns for any month at airports with available data. It generates a stacked bar chart, one bar for each hour of the day, color-coded by flight condition.

Example: Santa Monica vs Van Nuys in June

I learned to fly in Santa Monica, which is near the coast and frequently subject to marine layers. The analyzer shows this:

KSMO June weather prediction

  • At hour 0 UTC (5 PM local), VFR is 77%
  • By hour 10 UTC (3 AM local), VFR drops to just 28%, with a 72% chance of marine layer
  • Worst hours are 13-14 UTC (6-7 AM local): only 26-31% VFR
  • Best conditions are 20-22 UTC (1-3 PM local): 81-90% VFR

Our typical backup was Van Nuys, just 14 miles away but usually with better conditions due to being protected from the marine layer by the Santa Monica Mountains:

KVNY June weather prediction

  • Best VFR: 19 UTC through 6 UTC (noon through 11 PM local) at 81-94%
  • At worst hours (13-14 UTC / 6-7 AM local), VFR is still ~37-38%—better than KSMO's ~26-31%

How It Works

The predictor downloads several years of historical METAR data from the Iowa Environmental Mesonet ASOS network for your selected airport and month, then calculates the fraction of observations that fall into each flight condition for each hour of the day.

Flight conditions are determined by ceiling and visibility, with the more restrictive condition defining the overall flight condition:

Condition Ceiling Visibility
VFR ≥ 3,000 ft AGL ≥ 5 statute miles
MVFR ≥ 1,000 and < 3,000 ft AGL ≥ 3 and < 5 statute miles
IFR ≥ 500 and < 1,000 ft AGL ≥ 1 and < 3 statute miles
LIFR < 500 ft AGL < 1 statute mile

Setup

Dependencies are managed via conda. To create (or update) the environment:

conda env create -f environment.yml    # first time
conda env update -f environment.yml    # after changes to environment.yml

Then activate it before running anything:

conda activate avmapper

Usage

I split the predictor's core logic out into a separate library so it could be used in two ways: as both a web application and a command-line tool.

Command-Line Tool

Generate weather predictions for an airport as a PNG chart and/or text table:

# Generate PNG chart only (saves to KSMO-06.png in current directory)
./cli/metar_analyzer.py --airport KSMO --month 6 --chart

# Generate chart in a specific directory
./cli/metar_analyzer.py --airport KVNY --month 8 --chart --directory ~/weather_charts

# Print statistics table to stdout only (no chart)
./cli/metar_analyzer.py --airport KPAO --month 8 --table

# Generate both chart and table
./cli/metar_analyzer.py --airport KPAO --month 8 --chart --table

Options:

  • -a, --airport - Airport ICAO code (e.g., KSMO, KPAO) [required]
  • -m, --month - Month number (1-12) [required]
  • -c, --chart - Generate PNG chart (saves to <AIRPORT>-<MONTH>.png)
  • -d, --directory - Directory for output files (default: current directory)
  • -t, --table - Print hourly statistics table to stdout

At least one output option (-c/--chart or -t/--table) is required.

Web Application

The web application is simple: an input box with month and airport name. The airport name auto-completes based on a database I constructed of all airports that have weather data available: it's the intersection of the list of all stations from the Iowa Environmental Mesonet and the airport database from OurAirports. A script finds stations that appear in both databases and emits a list to a JSON file that the web front-end loads to drive the autocomplete feature.

Data Sources

About

A tool that draws graphs showing which hour-of-day an airport is most likely to have VFR weather

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors