Weather forecast for astrophotographers
This project comes from my long-time struggle to find a clean, no-nonsense weather forecast for astrophotography.
I wanted something that answers one simple question: "Is the weather good for astrophotography tonight, in the next 3 hours, or tomorrow?"
So, here it is – an ultra-minimalist weather forecast built specifically for astrophotographers.
No humidity, no precipitation, no pressure, or dew point to fuss over.
Just cloud cover, wind speed, and a simple "Ok" when conditions are good.
All information comes from Open-Meteo.com API.
- Detailed Weather Forecast: Provides temperature, cloud cover (low/mid/high), wind speed and gusts, moon illumination, and seeing index.
- Sun & Moon Calculations: Calculates sunrise, sunset, moonrise, and moonset times.
- Minimalist Interface: Focuses on relevant metrics for astrophotography, avoiding unnecessary weather details.
- Caching: API responses are cached to improve performance and reduce API calls.
- Location Suggestions: Offers geolocation suggestions for easier city selection.
- Frontend: HTML, JavaScript, Tailwind CSS (via CDN)
- Backend: Golang (net/http for web server, Open‑Meteo API integration)
- Caching: bigcache for in‑memory caching
- Geolocation: Open‑Meteo Geocoding API
- Go 1.23+
cd src
go run .Open http://localhost:8080.
cd src
go test ./...GET /– HTML UI (served with embedded templates and static assets)GET /weather?lat=<lat>&lon=<lon>– returns a plain‑text table forecastGET /suggestions?q=<query>– JSON location suggestions (Open‑Meteo Geocoding)GET /robots.txt,GET /favicon.ico,GET /static/*
Build a Docker image from the repo root (the Dockerfile expects sources under src/).
docker build -t aweather:latest .- The
-tflag allows you to tag the image with a name and version.
Run the container and map port 8080.
docker run -d -p 8080:8080 --name aweather aweather:latest- The
-dflag runs the container in detached mode (in the background). - The
-p 8080:8080maps the container's8080port to your host's8080port. - The
--name aweatherassigns a name to the container for easier management.
- Thresholds:
okstatus means cloud cover ≤ 25% at all levels and wind speed/gusts < 15 km/h (seeMaxCloudCover,MaxWindSpeed). - Cache: in‑memory cache TTL is 10 minutes.
- Port: the server listens on port
8080.
The application derives a heuristic “seeing index” from available meteorological fields to help rank time slots for astrophotography. It is not a physically calibrated arcsecond value and should be interpreted as: lower is better.
- Temperature:
temperature_2m,temperature_500hPa - Wind:
wind_speed_10m,wind_speed_850hPa,wind_speed_200hPa - Heights:
geopotential_height_500hPa(and site elevation)
- Compute an elevation‑aware temperature lapse across the total depth from site elevation to 500 hPa:
(T2m − T500) / depth_km. - Form a vertical wind shear proxy:
|V200 − V850| + |V850 − V10|(all in m/s). - Seeing index ∝
shear^0.6 * |lapse|^0.4. A small jet‑stream penalty applies above ~22 m/s at 200 hPa, capped to avoid runaway values. - The result is clamped to a reasonable range for readability (≈0.5–5.0).
This index is intended for relative comparison between hours/nights rather than absolute image resolution.