Skip to main content

MinxiongHydroCast

CI CodeQL Release Python License: MIT Status Forecast

Official-source hydrometeorological observations and reproducible rainfall-nowcasting research for Minxiong, Taiwan.

Status: Operational Prototype / Active Research. The observation service is usable on a localhost-only deployment. Forecast publication and automated risk notifications remain disabled until the model, label, and shadow-deployment gates pass.

MinxiongHydroCast operator dashboard showing a healthy live snapshot and a blocked shadow gate

Real localhost operator view captured on 2026-07-29. It uses live official observations; values change over time. The blocked shadow gate is intentional.

What problem does this solve?

Official rainfall, radar, warning, and flood-sensor feeds are useful but have different schemas, cadences, failure modes, and retention windows. A downloader alone cannot answer whether a snapshot is fresh, internally consistent, reproducible, or safe to expose.

MinxiongHydroCast turns those feeds into a fail-closed observation and research system:

  • strict Pydantic contracts, freshness checks, and cross-page WRA sensor joins;
  • bounded retries and explicitly degraded fallbacks without hiding schema drift;
  • immutable snapshots with SHA-256, source authority, dataset ID, fetch time, and adapter version;
  • CLI, read-only API, health/readiness endpoints, Prometheus metrics, backup, and operator view;
  • reproducible CWA radar event datasets with human-reviewed evidence and fixed event splits;
  • Persistence and Tiny U-Net evaluation behind promotion gates that can block publication.

That operational and scientific boundary is the main difference from a general weather-data download script.

Architecture

flowchart LR
    subgraph Official["Official sources"]
        CWA["CWA Open Data<br/>gauges · radar · QPE"]
        WRA["WRA Open Data<br/>warnings · flood sensors"]
    end

    CWA --> INGEST["Adapters<br/>bounded retries"]
    WRA --> INGEST
    FALLBACK["WRA page parser<br/>degraded diagnostics"] -. transport-only fallback .-> INGEST
    INGEST --> CONTRACTS["Strict contracts<br/>schema · freshness · joins"]
    CONTRACTS --> SNAPSHOTS["Immutable snapshots<br/>provenance · SHA-256"]
    SNAPSHOTS --> SERVICE["Read-only service<br/>API · health · readiness · metrics · UI"]
    CONTRACTS --> EVIDENCE["Radar event evidence<br/>human review"]
    EVIDENCE --> DATASET["Reproducible event splits<br/>tensor archives"]
    DATASET --> MODELS["Persistence<br/>weighted Tiny U-Net"]
    MODELS --> GATES{"Model + label +<br/>shadow gates"}
    GATES -- pass --> FORECAST["Experimental forecast API"]
    GATES -- blocked --> CLOSED["Forecast unavailable"]

Schema drift, invalid units or timestamps, broken measurement/catalog joins, and unexpected empty observation sets fail the attempt. The optional scraper fallback is limited to transport, authentication, timeout, HTTP, or rate-limit failures and never satisfies readiness. See the architecture and data contracts.

Official data flow

Product Authority and dataset Use Repository behavior
Rain gauges CWA O-A0002-001 Chiayi rainfall observations Strict schema and 30-minute freshness gate
Rainfall warnings WRA OpenApiv3 Rainfall/Warning Active Chiayi warning context Authenticated API; validated Data=[] is healthy
Flood sensors WRA IoW Open Data 142980 + 142979 Measurement/catalog join Bounded full-transaction retry and 90-minute freshness gate
Radar CWA O-A0059-001 10-to-60-minute research nowcasting External event archives; checksummed fixed splits
QPE CWA O-B0045-001 Radar/gauge validation evidence External synchronized evidence; not committed

API keys, official raw files, research evidence, model weights, live snapshots, CCTV, and host configuration are not committed. The source register records authority, acceptance, and redistribution questions.

Current status

Public-safe verification on 2026-07-29:

Layer Maturity Evidence
Observation service Operational Prototype Latest live snapshot healthy: 80 CWA gauges, 150 WRA flood sensors, validated empty warning set
Reliability Active 1,150 rolling attempts; 99.39% success and 97.39% readiness
Shadow gate Blocked Maximum ready-data gap 50.98 minutes; no confirmed heavy-rain period
Radar dataset Active Research Five real CWA events: 2 train / 1 validation / 2 held-out local tests
Forecast API Disabled Tiny U-Net does not consistently beat Persistence on CSI and lead-time gates

These are dated observations, not an availability promise. The current public-safe rollout record is in deployment status.

Baseline results

The formal experiment uses six radar input frames to predict six target frames at 10-minute cadence. Metrics below use independent validation/test events; lower RMSE and higher CSI are better.

Event Split Persistence RMSE Tiny U-Net RMSE Persistence CSI Tiny U-Net CSI
Taiwan 2026-07-09 validation 9.654280 8.053179 0.188989 0.205842
Minxiong/Chiayi 2026-07-03 test 10.421478 9.186911 0.315475 0.294527
Minxiong/Chiayi 2026-07-11 test 9.154027 8.218313 0.119412 0.122282

The weighted Tiny U-Net lowers aggregate RMSE on all three events, but CSI regresses on one local test event and some 10-to-60-minute lead-time gates regress. Therefore forecast_publication_ready=false; Persistence remains the required benchmark. See the full baseline results, model card, and reproducibility evidence.

Quick Start

Python 3.11 and 3.13 are tested in CI.

The fastest path is a credential-free, synthetic demo:

docker compose up --build

Open http://127.0.0.1:8080/. The dashboard shows demo rain gauges and flood sensors, /healthz, intentionally blocked /readyz, Prometheus /metrics, and the forecast publication gate. No API key or live official request is used.

If port 8080 is already in use, choose another host port:

MHC_DEMO_PORT=18080 docker compose up --build

Synthetic Docker demo walkthrough: blocked readiness, demo observations, region coverage, and blocked forecast gate

A 60-second capture of the credential-free synthetic stack. Every source is classified as demo_fixture; readiness and forecast publication stay blocked.

For a local Python installation:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"

Create a deterministic demo snapshot without contacting live sources, then open the operator view:

mhc collect --region minxiong --mode demo --once
mhc serve --host 127.0.0.1 --port 8080

In another terminal:

curl --fail http://127.0.0.1:8080/healthz

Open http://127.0.0.1:8080/. Demo data intentionally does not pass readiness. Live collection requires CWA/WRA credentials in an ignored .env; follow operational use rather than placing secrets on the command line.

Useful entry points:

mhc --help
mhc collect --help
mhc serve --help
mhc dataset build --help
mhc event queue --help
mhc model evaluate --help
mhc model evaluate-optical-flow --help
mhc model optical-flow-report --help
mhc operations backup --help

The base wheel installs only Pydantic, Requests, and NumPy. Install capability extras only when needed:

pip install "minxiong-hydrocast[scraper]"
pip install "minxiong-hydrocast[model]"
pip install "minxiong-hydrocast[report]"

Example output

A live /readyz response can be reduced to the service contract with:

curl --silent http://127.0.0.1:8080/readyz |
  jq '{state, ready, latest_snapshot: {mode: .latest_snapshot.mode},
       latest_attempt: {status: .latest_attempt.status}}'
{
  "state": "healthy",
  "ready": true,
  "latest_snapshot": {"mode": "live"},
  "latest_attempt": {"status": "ok"}
}

The service also exposes /healthz, /metrics, /api/v1/status, official observations, region features, locations, shadow readiness, and a fail-closed experimental forecast endpoint.

Evaluation and tests

python -m compileall -q src tests scripts
python -m ruff check .
python -m pytest -q

CI runs the same quality gates on Python 3.11 and 3.13. CodeQL, Dependabot, secret scanning, and protected main rules provide repository-level controls. A separate clean-wheel job builds both distributions, installs the wheel, verifies that mhc is the only executable, and exercises the synthetic API/readiness/metrics/forecast-gate flow. Scheduled live-contract checks detect upstream CWA/WRA changes without printing credentials.

Limitations

  • This is not an official warning system, public forecast service, or emergency decision tool.
  • Five radar events do not cover enough typhoon, frontal, Mei-yu, and convective regimes.
  • Radar reflectivity is not surface rainfall or flood depth; QPE/gauge validation is incomplete.
  • Reviewed local flood labels have not reached the 10-positive / 20-negative minimum.
  • The rolling shadow gate still lacks a confirmed heavy-rain period and has a gap above 30 minutes.
  • Official data and trained-weight redistribution rights require separate review.
  • The supplied deployment profile is localhost-only; public ingress requires authentication, TLS, ownership, incident response, and completed gates.

Data, model, and code license

Repository code is released under the MIT License. That license does not relicense CWA or WRA data, third-party documents, research evidence, or trained weights. This repository ships schemas and synthetic samples, not an official dataset or model checkpoint. Review the data source register and each authority's terms before redistribution or commercial use.

Roadmap and releases

Version Milestone State
v0.1.0 Observation Service Previous release
v0.1.1 One-command demo, lean package, region/adapter contracts, contributor entry Previous release
v0.1.3 Version metadata alignment and release consistency Current release
v0.1.2 Deterministic optical-flow benchmark and public-safe comparison report Previous release
v0.2.0 Reproducible Radar Dataset Planned; requires broader reviewed event diversity
v0.3.0 Baseline Nowcasting Planned; requires model, label, and lead-time gates

See CHANGELOG.md, the v0.1.3 release notes, the v0.1.2 release notes, and the long-term roadmap. Current work belongs in tasks; generated deployment numbers do not belong in the README.

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minxiong_hydrocast-0.1.3.tar.gz (218.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minxiong_hydrocast-0.1.3-py3-none-any.whl (209.8 kB view details)

Uploaded Python 3

File details

Details for the file minxiong_hydrocast-0.1.3.tar.gz.

File metadata

  • Download URL: minxiong_hydrocast-0.1.3.tar.gz
  • Upload date:
  • Size: 218.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for minxiong_hydrocast-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c0913375fef467014c7c6c8c8449633eca265b8b9c4320d9004443a47f51bd39
MD5 222cc737afcd658b6c92c9c33317e4c7
BLAKE2b-256 3212e0ed5fd0d6bc08c56227170186c9e3292240c9888c29ec766563c8acf030

See more details on using hashes here.

Provenance

The following attestation bundles were made for minxiong_hydrocast-0.1.3.tar.gz:

Publisher: release.yml on KageRyo/MinxiongHydroCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file minxiong_hydrocast-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for minxiong_hydrocast-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 75e823451cab875bfef285d8d59d197ab8a365ca5c9261ea5452abd04665f106
MD5 a7d4834860c807f1124407de5c4b31e3
BLAKE2b-256 7485d562877720de3e40022e272c866fc81488853ebee2fb08939d011cbc69f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for minxiong_hydrocast-0.1.3-py3-none-any.whl:

Publisher: release.yml on KageRyo/MinxiongHydroCast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page