Files
aimsight-app/weather/README.md
T
maximeandClaude Opus 5.5 eaa124f9f5 Weather: the MeteoSwiss measurements at a place over a past range
weather/meteoswiss.py <place> <start> <end>: the hourly values of the
nearest SwissMetNet station (precipitation, temperature, humidity, wind,
pressure, sunshine, radiation, snow), from the MeteoSwiss Open Data, as CSV.
The place is a Swiss name (swisstopo search) or lat,lon; times in UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:54:28 +01:00

1.7 KiB

weather

The weather really measured at a place over a past range: the hourly values of the MeteoSwiss automatic weather station (SwissMetNet) nearest to the place. Measurements, not a model output.

python3 weather/meteoswiss.py <place> <start> <end> [--out FILE]
python3 weather/meteoswiss.py "Genève" 2026-11-15 2026-11-16 --out gve.csv
python3 weather/meteoswiss.py 46.52,6.63 2025-06-01T12:00 2025-06-01T18:00
  • place: a Swiss place name, resolved by the swisstopo search (api3.geo.admin.ch), or coordinates lat,lon (WGS84). The resolved place and the chosen station (name, distance, altitude) are written on stderr: check them, the search always returns its best match.
  • start, end: YYYY-MM-DD or YYYY-MM-DDTHH:MM, in UTC, end excluded. The range is in the past.
  • The output: a CSV, one row per hour, time_utc (start of the hour) and station, then precipitation_mm, temperature_c, humidity_pct, wind_speed_kmh, wind_gust_kmh, wind_direction_deg, pressure_hpa (at the station, QFE), sunshine_min, global_radiation_wm2, snow_depth_cm. An empty cell: not measured at this station or at this hour.

The source is the Open Data of MeteoSwiss, free, without key (terms of use, documentation of the dataset); the files of a station are listed by the STAC API (data.geo.admin.ch/api/stac/v1/collections/ch.meteoschweiz.ogd-smn/items/<station>). The values are quality-checked by MeteoSwiss, except those of the current day (now file). Hourly series from 1980 at most, depending on the station. Standard library only.