-----
**Generative Recipe: Local Station Weather Blend**
A small public-service experiment in getting weather data closer to the ground.
Most weather apps give you a single number. That number usually comes from a model that has already decided which stations matter and how to smooth them. You rarely see the stations themselves.
This generative recipe does the opposite. It finds the three nearest public weather observation stations to your location, pulls their latest readings, and blends them with a simple inverse-distance weighting. You get both the blended result and the individual station data so you can judge it yourself.
It uses only free, public U.S. National Weather Service data. No API key. No commercial weather provider in the middle.
### The Recipe
**Goal**
Build a lightweight web page that:
- Asks for (or detects) your location
- Finds the three nearest NWS observation stations with recent data
- Fetches their latest observations
- Computes a distance-weighted blend of temperature, humidity, and wind
- Shows the blend plus the raw station readings for transparency
**Data source**
National Weather Service API (`https://api.weather.gov`). Public domain. Requires only a descriptive User-Agent header.
**Core steps an AI coding assistant should follow**
1. Get the user’s coordinates (browser geolocation with a manual lat/lon fallback).
2. Call `/points/{lat},{lon}` to obtain the list of nearby observation stations.
3. Take the closest stations that have a recent temperature reading (ideally under two hours old).
4. For each station, fetch `/stations/{id}/observations/latest`.
5. Calculate inverse-distance weights: weight = 1 / distance^p (p = 1 or 2 works well).
6. Produce a blended temperature, humidity, and wind speed. Show wind direction from the nearest station or a simple vector average.
7. Display:
- The blended values clearly
- Each station’s name, distance, observation age, and raw values
- A refresh button
**Constraints for a clean public version**
- Prefer a single HTML file or very small set of files so anyone can save and run it locally.
- No backend required.
- Clear unit toggles (°C/°F, m/s or mph).
- Graceful handling when fewer than three good stations are available.
- Always send a proper User-Agent string.
**Optional but useful**
- Side-by-side comparison with a model-based value (for example from Open-Meteo) so readers can see the difference.
- Simple confidence note based on station distance and observation age.
### Why this is worth publishing
It is deliberately modest. It does not claim to be more accurate than every commercial product. It simply makes the underlying public observations visible and lets the user see how a blend is constructed. That transparency is the point.
It also serves as a concrete example of a **generative recipe**: a short, reusable set of instructions written so that an AI coding tool (or a human following carefully) can produce a working result with minimal extra decision-making. The recipe itself is the artifact.
Anyone interested can take the recipe above, paste it into an AI coding assistant, and generate their own version. The resulting page can be saved and used offline or hosted anywhere.
This is a small proof of concept for making public data more directly usable, and for treating clear instructions as a shareable product in their own right.
No comments:
Post a Comment