Files
Northern-Thailand-Ping-Rive…/src/data/stations.json
T
grabowski 4358d52d55
Security & Dependency Updates / Dependency Security Scan (push) Successful in 1m8s
Security & Dependency Updates / License Compliance (push) Successful in 25s
Security & Dependency Updates / Check for Dependency Updates (push) Successful in 20s
Security & Dependency Updates / Code Quality Metrics (push) Successful in 17s
Security & Dependency Updates / Security Summary (push) Successful in 9s
feat: ML flood-event forecasting from 8 years of gauge history
Add src/ml/ package predicting, per station and per 6/12/24 h horizon,
the probability of exceeding warning (3.0 m) and danger (4.5 m) levels
plus expected peak level, trained on the 592k-row PostgreSQL history:

- features.py: hourly grid with coverage gating and no future leakage;
  upstream stations enter at empirically measured travel-time lags
  (P.20 +17h ... P.103 +1h vs P.1); hour-of-day deliberately excluded
  (it encodes the scrape schedule, not hydrology)
- train.py: HistGradientBoosting regression + warn/danger classifier
  heads per station x horizon, >=30-positives gate with calibrated
  sigmoid-on-regression fallback, strict temporal splits, per-event
  lead-time evaluation; guards against sklearn 1.9.0 crash on
  degenerate feature columns
- predict.py: bundle loading with feature-name checks, heuristic
  fallback tier, get_latest_forecasts() for the API; raises when no
  models are trained so the endpoint 503s instead of serving
  persistence output as forecasts
- data.py: Postgres-first loader (FLOOD_ML_DB_URL override), HTTP API
  fallback (flagged: that path backfills synthetic discharge), csv.gz
  cache
- /forecast endpoint (15-min TTL cache) + dashboard flood-risk panel
  (hidden until models exist)
- docs/FLOOD_FORECASTING.md: full system doc with measured deployment
  numbers (~335 MB RSS, CPU negligible, ~6 min full retrain) and
  retraining policy

Validation: out-of-sample backtest of the record 2024 flood season
(train <= Aug 2024) alerted 24-48 h ahead of the Oct 5 peak; 2025-26
test split: P.1 6h PR-AUC 0.974, recall 98.3% at 1% false-alarm rate.

Also: fix P.81 station coordinates (was Ban Pong/Ratchaburi, 493 km
out of basin; now 18.6936 N 99.0819 E per RID station page), pin
scikit-learn==1.9.0 and numpy<2, gitignore model artifacts (~100 MB,
train on the server via scripts/train_flood_model.py).
2026-08-10 12:49:47 +07:00

131 lines
3.3 KiB
JSON

{
"1": {
"code": "P.20",
"thai_name": "บ้านเชียงดาว",
"english_name": "Ban Chiang Dao",
"latitude": 19.36731448032191,
"longitude": 98.9688487015384,
"geohash": null
},
"2": {
"code": "P.75",
"thai_name": "บ้านช่อแล",
"english_name": "Ban Chai Lat",
"latitude": 19.145972935976225,
"longitude": 99.00735727149247,
"geohash": null
},
"3": {
"code": "P.92",
"thai_name": "บ้านเมืองกึ๊ด",
"english_name": "Ban Muang Aut",
"latitude": 19.220518985435646,
"longitude": 98.84733127007874,
"geohash": null
},
"4": {
"code": "P.4A",
"thai_name": "บ้านแม่แตง",
"english_name": "Ban Mae Taeng",
"latitude": 19.1222679952378,
"longitude": 98.94437462084075,
"geohash": null
},
"5": {
"code": "P.67",
"thai_name": "บ้านแม่แต",
"english_name": "Ban Tae",
"latitude": 19.009762080002453,
"longitude": 98.95978297135508,
"geohash": null
},
"6": {
"code": "P.21",
"thai_name": "บ้านริมใต้",
"english_name": "Ban Rim Tai",
"latitude": 18.917459157963293,
"longitude": 98.97018092996231,
"geohash": null
},
"7": {
"code": "P.103",
"thai_name": "สะพานวงแหวนรอบ 3",
"english_name": "Ring Bridge 3",
"latitude": 18.86664807441675,
"longitude": 98.9781107622432,
"geohash": null
},
"8": {
"code": "P.1",
"thai_name": "สะพานนวรัฐ",
"english_name": "Nawarat Bridge",
"latitude": 18.7875,
"longitude": 99.0045,
"geohash": "w5q6uuhvfcfp25"
},
"9": {
"code": "P.82",
"thai_name": "บ้านสบวิน",
"english_name": "Ban Sob win",
"latitude": 18.6519444,
"longitude": 98.69,
"geohash": null
},
"10": {
"code": "P.84",
"thai_name": "บ้านพันตน",
"english_name": "Ban Panton",
"latitude": 18.591315274591334,
"longitude": 98.79657058508496,
"geohash": null
},
"11": {
"code": "P.81",
"thai_name": "บ้านโป่ง",
"english_name": "Ban Pong",
"latitude": 18.693611,
"longitude": 99.081944,
"geohash": null
},
"12": {
"code": "P.5",
"thai_name": "สะพานท่านาง",
"english_name": "Tha Nang Bridge",
"latitude": 18.580269437546555,
"longitude": 99.01021397084362,
"geohash": null
},
"13": {
"code": "P.77",
"thai_name": "บ้านสบแม่สะป๊วด",
"english_name": "Baan Sop Mae Sapuord",
"latitude": 18.433347475179602,
"longitude": 99.08510036666527,
"geohash": null
},
"14": {
"code": "P.87",
"thai_name": "บ้านป่าซาง",
"english_name": "Ban Pa Sang",
"latitude": 18.519121825282486,
"longitude": 98.94224374138238,
"geohash": null
},
"15": {
"code": "P.76",
"thai_name": "บ้านแม่อีไฮ",
"english_name": "Banb Mae I Hai",
"latitude": 18.141465831254404,
"longitude": 98.89642508267181,
"geohash": null
},
"16": {
"code": "P.85",
"thai_name": "บ้านหล่ายแก้ว",
"english_name": "Baan Lai Kaew",
"latitude": 18.17856361002219,
"longitude": 98.63023114782287,
"geohash": null
}
}