From 088484c376423b0f61c22a685829b02774a958aa Mon Sep 17 00:00:00 2001 From: maxime Date: Tue, 17 Nov 2026 08:51:48 +0100 Subject: [PATCH] stations.txt: SERIAL [position], the position read by the app for the weather Co-Authored-By: Claude Opus 5.5 --- extraction/README.md | 2 +- extraction/pump.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extraction/README.md b/extraction/README.md index 068207f..e0e5d80 100644 --- a/extraction/README.md +++ b/extraction/README.md @@ -8,7 +8,7 @@ Formats: `~/aimsight-labeling/knowledge/displacement-columns.md`. -**Tracked stations**: `stations.txt`, one serial number per line. Without station nor dates, the script updates them all up to now: each station first fills its missing days between the first and the last pumped day (without displacements, or without any metric), then restarts from its last day, pumped again (it was perhaps incomplete); a station without a folder in `data/` gets the last 30 days. +**Tracked stations**: `stations.txt`, one serial number per line, optionally followed by the position of the station (`lat,lon` or a Swiss place, read by the app for the weather; the app edits this list: Data page, "Stations"). Without station nor dates, the script updates them all up to now: each station first fills its missing days between the first and the last pumped day (without displacements, or without any metric), then restarts from its last day, pumped again (it was perhaps incomplete); a station without a folder in `data/` gets the last 30 days. Resuming: with `--from`, a file already in `data//` is not asked for again; running again on a wider range reads only the days and images that are missing. The current day is pumped as it is, its metrics up to the last completed hour; the next run without `--from` replaces it. diff --git a/extraction/pump.py b/extraction/pump.py index deb3354..3657c7f 100644 --- a/extraction/pump.py +++ b/extraction/pump.py @@ -43,7 +43,7 @@ from sqlalchemy import create_engine, text from sqlalchemy.engine import URL UTC = timezone.utc -STATIONS = Path(__file__).resolve().parent / "stations.txt" # the tracked stations, one per line +STATIONS = Path(__file__).resolve().parent / "stations.txt" # the tracked stations, one per line: "SERIAL [position]" NEW_STATION_DAYS = 30 # without --from, a station with no pumped displacements: the last 30 days DB_NAMES = ["AIMSIGHT_DATABASE_USER", "AIMSIGHT_DATABASE_PSWD", "AIMSIGHT_DATABASE_TURL", "AIMSIGHT_DATABASE_NAME"] TYPES = {"images": "OPTICAL_SHIFT-IRON", "images_diff": "OPTICAL_SHIFT-DIFF"} # folder -> measurement type @@ -361,7 +361,7 @@ def main(): tomorrow = datetime.now(UTC).date() + timedelta(days=1) start = datetime.strptime(a.start, "%Y-%m-%d").date() if a.start else None end = min(datetime.strptime(a.end, "%Y-%m-%d").date(), tomorrow) if a.end else tomorrow # no day to come - stations = a.stations or STATIONS.read_text().split() + stations = a.stations or list(dict.fromkeys(l.split()[0] for l in STATIONS.read_text().splitlines() if l.strip())) missing = [n for n in DB_NAMES if not os.environ.get(n)] if missing: