update for 4 hour rain forecast

This commit is contained in:
2026-04-06 18:32:33 +10:00
parent fb50c8ed71
commit 3a7309b2cf
20 changed files with 716 additions and 132 deletions
+9 -4
View File
@@ -76,7 +76,8 @@ TimescaleDB schema is initialized from `db/init/001_schema.sql` and includes:
- `observations_ws90` (hypertable): raw WS90 observations with payload metadata, plus the full JSON payload (`payload_json`).
- `observations_baro` (hypertable): barometric pressure observations from other MQTT topics.
- `forecast_openmeteo_hourly` (hypertable): hourly forecast points keyed by `(site, model, retrieved_at, ts)`.
- `predictions_rain_1h` (hypertable): model probability + decision + realized outcome fields.
- `predictions_rain_1h` (hypertable): legacy 1-hour model probability + decision + realized outcome fields.
- `predictions_rain_4h` (hypertable): 4-hour model probability + decision + realized outcome fields.
- Continuous aggregates:
- `cagg_ws90_1m`: 1minute rollups (avg/min/max for temp, humidity, wind, uvi, light, rain).
- `cagg_ws90_5m`: 5minute rollups (same metrics as `cagg_ws90_1m`).
@@ -86,14 +87,18 @@ Retention/compression:
- `observations_baro` has a 90day retention policy and compression after 7 days.
### Existing databases
If youre on an existing database, youll need to apply the new table definition once (the init SQL only runs on a fresh DB). Example:
If youre on an existing database, apply the 4-hour prediction table migration:
```sh
docker compose exec -T timescaledb psql -U postgres -d micrometeo -f /docker-entrypoint-initdb.d/003_rain_predictions_4h.sql
```
If you also need to backfill older schema objects, you can still re-run:
```sh
docker compose exec -T timescaledb psql -U postgres -d micrometeo -f /docker-entrypoint-initdb.d/001_schema.sql
```
Or copy just the `observations_baro` section into a manual `psql -c`.
For rain-model monitoring views, also apply `db/init/002_rain_monitoring_views.sql` on existing DBs:
```sh