Skip to main content
This lesson walks through creating a lightweight Flask web application that fetches and decodes METAR weather reports into plain English. The result: a small web form where a user types an ICAO airport code (e.g., KJFK, KLAX) and receives a human-friendly weather summary plus the raw METAR. Keywords: Flask METAR reader, METAR decoder, aviationweather.gov, ICAO, NOAA ADDS.

What is a METAR?

METAR is the international (ICAO) standard format for aviation weather observations. The encoded lines can look cryptic to non-pilots but contain a compact, consistent representation of winds, visibility, clouds, temperature, pressure, and weather phenomena. Our app uses a public METAR API and decodes each field into readable phrases.
A screenshot of a web browser open to the Wikipedia article for "METAR,"
showing the article text and contents list on the left with a small photo and
appearance settings on the right. The browser window includes tabs and a dark
desktop
background.
Example raw METAR (compact / cryptic):
A decoded app should present that as human-readable lines like:
  • Winds 160° at 8 knots
  • Visibility 10 statute miles
  • Scattered clouds at 4,700 ft and 21,000 ft; broken at 25,000 ft
  • Temperature 24°C / Dew point 21°C
  • Altimeter 30.31 inHg

METAR components quick reference

Project plan and goals

  • Build a Flask web app with:
    • An input form for ICAO codes (index page)
    • A results template showing parsed summary + raw METAR
    • Basic, responsive styling (static/style.css)
  • Use a public METAR data source (NOAA/ADDS or aviationweather.gov)
  • Implement a METAR decoder that:
    • Extracts winds, visibility, cloud layers, temperatures, altimeter, observation time, and weather phenomena
    • Converts wind degrees to compass headings and reports calm conditions
    • Converts units where helpful (°C ↔ °F, inHg)
  • Include basic error handling: invalid ICAO, no data, network errors
  • Provide a reproducible local workflow using a virtual environment

Example CLI: starting Claude Code For Beginners

A typical interactive session starting Claude Code (example):
Example condensed prompt sent to Claude Code For Beginners:

What Claude generated and common tasks

Claude helped scaffold the project and suggested a todo list and file structure. Typical outputs and tasks include:
  • Files generated
    • app.py — Flask application and route handlers
    • metar_decoder.py — parsing and conversion helpers (wind, clouds, visibility, etc.)
    • templates/index.html — search form
    • templates/result.html — decoded results and raw METAR
    • static/style.css — basic styling
    • requirements.txt — Python dependencies
Example requirements.txt produced:
Common coding tasks to implement:
  • Fetch METAR data from aviationweather.gov or NOAA ADDS endpoints
  • Implement a robust METAR decoder to parse:
    • Wind: “16008KT” → 160° at 8 knots; detect “00000KT” (calm)
    • Visibility: e.g., “10SM” → 10 statute miles or “1/2SM”
    • Clouds: convert “SCT047” to “scattered at 4,700 ft”; handle CLR/SKC
    • Temperature/dew: parse “24/21” and produce °C and approximate °F
    • Altimeter: “A3031” → 30.31 inHg
    • Phenomena codes: RA (rain), SN (snow), FG (fog), BR (mist), TS (thunderstorm), SH (showers)
  • Create Jinja templates to display both the friendly summary and the raw METAR string
  • Add unit tests for the decoder functions

Project scaffolding (example commands)

  • Create project layout:
    • mkdir -p metar_reader/{templates,static}
    • touch app.py metar_decoder.py requirements.txt
  • Virtual environment and install:

Running the app locally

After installing dependencies in a virtual environment:
Flask development server defaults to: Note: Ensure the venv is activated in the same shell where you run python so the installed packages are available.
Run: python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt. Then start the app with python app.py and open http://127.0.0.1:5000 in your browser.

Testing in the browser — KHIO example

Try KHIO (Hillsboro, OR) in the web form. The app fetches the METAR and displays a readable weather card. Example decoded output shown by the app:
  • Clear skies, 27°C (≈81°F)
  • Wind: 000° at 0 knots (calm)
  • Visibility: 10+ statute miles
  • Altimeter: 30.05 inHg
  • Observation time: timestamp from the METAR
Raw METAR:
A browser window showing a "Weather Report for KHIO" with current conditions
(clear skies, 81°F / 27°C, wind from the north at 0 knots) and a detailed
table of observation data. The report is centered on a purple gradient
background.

Testing in the browser — KLAX example

Enter KLAX (Los Angeles) to verify cloud layers, winds, and other fields are parsed and presented cleanly. Raw METAR:
Decoded example:
  • Few clouds at ~25,000 ft
  • Temperature 24°C (≈75°F), dew point 17°C
  • Wind 260° at 11 knots
  • Visibility 10 statute miles
A browser screenshot of a "Weather Report for KLAX" webpage showing current
conditions (few clouds at 25,000 ft, 75°F / 24°C, wind from the west at 11
knots) and a detailed information table below. The page is displayed on a
purple gradient background with a white card in the
center.

Next steps and extensions

This project is a useful base for further improvements:
  • Add unit tests for the METAR decoder (pytest)
  • Improve UI/UX and accessibility (ARIA, keyboard nav)
  • Harden error handling (API rate limits, retries, invalid ICAO codes)
  • Cache or store historical METARs for trend displays
  • Extend to other aviation products (TAFs, SIGMETs) or integrate with mapping libraries
Thanks for following this lesson — use this METAR reader as a foundation to explore more automated coding workflows and to build reliable, testable utilities around real-world aviation data.

Watch Video