Pumping: the weather of the stations with a position written into data/<SERIAL>/weather/ (extraction/weather.py, after pump.py); the mm (corr_x_mm, corr_y_mm by the sensor_id of each row) and targets.csv with the references (pattern_type, distance_mm, mm_per_px); --replace pumps a range again

pump.py --check passes; the mm and targets.csv parts are not yet run against the database (no VPN).
stations.txt: NIEDERHORN and NORDEND without a position (outside Switzerland).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 07:17:27 +01:00
1 parent 9adc38f9b9
commit ea0228a73a
8 files changed
+205 -22

No files matched your search

+2 -2
View File
@@ -8,9 +8,9 @@ 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
```
A caller (the Data page of aimsight-app) calls `hourly(place, start, end)` -> `(where, {time: {column: value or None}})`, `where` the place found and the station chosen; `LookupError` for a place not found, `OSError` when MeteoSwiss or swisstopo do not answer.
The pumping writes it into `data/<SERIAL>/weather/<SERIAL>_weather_<YYYYMMDD>.csv` (`extraction/weather.py`): the columns below, `station` followed by `position` (the line of `stations.txt`), `place`, `station_name`, `distance_km`, `height_m`; the app and the agents read these files. A caller calls `hourly(place, start, end)` -> `(where, {time: {column: value or None}})`, `where` the place found and the station chosen; `LookupError` for a place not found, `OSError` when MeteoSwiss or swisstopo do not answer.
- `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.
- `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. A best match whose label does not start with the first word asked is refused (`Toronto` gave `Trient (VS)`): a place outside Switzerland has no weather here, MeteoSwiss measures in Switzerland only.
- `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.