Skip to main content
In this lesson/article we scaffold a minimal METAR reader web app using Flask and Python. The app accepts an airport ICAO code (for example, KJFK or KHIO), fetches the current METAR from aviationweather.gov (ADDS), and presents both the raw METAR string and a human-friendly decoded weather summary (wind, visibility, clouds, temperature/dew point, and altimeter). This guide gives a compact, working example you can run locally, extend, and test. Keywords: METAR reader, Flask app, METAR decoder, aviationweather, Python, requests. What is a METAR?
  • METAR is a standardized, concise aviation weather observation string that contains station identifier, time, wind, visibility, cloud layers, temperature/dew point, altimeter, and optional remark fields. METARs are machine- and human-readable for trained users but can look cryptic to the general public.
Example raw METARs:
A pilot or meteorologist can parse those tokens to extract wind, visibility, clouds, temperature, pressure and more. Our app focuses on fetching these strings and converting common tokens to plain English (for example: “Clear day, 81°F (27°C), calm wind”). Quick project goals
  • Build a Flask web application
  • Provide an HTML form to input an airport ICAO code
  • Query the ADDS (aviationweather.gov) METAR endpoint for the most recent METAR
  • Decode common METAR tokens (wind, visibility, clouds, temperature/dew point, pressure/altimeter)
  • Display both the decoded summary and the raw METAR
  • Add basic error handling and keep the project minimal and extensible
Project structure (files) Security warning when using Claude Code locally
The CLI snippet below shows a prompt from Claude Code asking whether to trust files in a folder. Only allow execution of code from sources you trust. Executing untrusted code can be unsafe.
Starting Claude Code for Beginners in the repository (example CLI interaction)
High-level to-dos that guided the scaffolding:
  • Set up a Flask application structure with a main app.py file
  • Create an HTML template for an airport code input form
  • Implement METAR fetching from aviationweather.gov (ADDS) API
  • Create a METAR decoder that converts cryptic tokens to readable text
  • Add error handling for invalid airport codes and network errors
  • Create a results template that shows both the decoded report and raw METAR
  • Add minimal CSS styling for readability
  • Test the application with several airport codes
A compact, working example Below is a concise, functional implementation you can copy, run, and extend. Keep the code blocks as separate files in your project. app.py
templates/index.html
templates/result.html
static/style.css (very basic)
requirements.txt
Run locally
Then open http://127.0.0.1:5000 in your browser. Example: KHIO result
  • When you test with KHIO, the app will query ADDS, retrieve the most recent METAR, and decode it. The decoded output typically shows clear skies, temperature in °F and °C, wind (calm or direction/speed), visibility, and the altimeter, plus the raw METAR string for reference.
A webpage screenshot displaying a "Weather Report for KHIO" with current conditions: clear skies, 81°F (27°C), wind from the north at 0 knots. The page also shows detailed observations like visibility, dew point and barometric pressure.
Notes and next steps
This example is a pragmatic starting point. The METAR decoder is intentionally simple—METARs can include runway visual range, precipitation and obscuration groups (RA, SN, TS, FG, BR), automated sensor flags (AO1/AO2), and many remark fields. For production usage, extend parsing to cover more tokens, add unit tests, rate-limit handling, caching, and improved UI/UX for mobile devices.
Suggested improvements and checklist
  • Extend the decoder to handle precipitation, obscurations, and thunderstorm notations (e.g., RA, SN, TS, FG, BR).
  • Add unit tests for METARDecoder.decode_* functions and for fetch_metar.
  • Implement caching and exponential backoff to handle ADDS rate limits.
  • Improve error messages for invalid ICAO codes and no-data responses.
  • Consider requesting format=xml or format=xml&dataSource=metars from ADDS if you prefer structured parsing, or use a dedicated METAR parsing library.
Links and references This base project gives a quick path from idea to working web app so you can iterate, add documentation, tests, and integrations while keeping the core functionality clear and extensible.

Watch Video