Skip to main content

MinxiongHydroCast

CI CodeQL Release Python License: MIT Status Forecast

Official-source hydrometeorological observations and reproducible rainfall-nowcasting data and model development for Minxiong, Taiwan.

Status: Operational Prototype / Data and Model Development. 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, data, and model 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 model development 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, event 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 Data pipeline 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 data assets.

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 data relocate-root --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, event 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.6 Complete retirement of AIWeatherForecast legacy documentation Current release
v0.1.5 Verified data-root relocation command and metadata integrity repair Previous release
v0.1.0 Observation Service Previous release
v0.1.1 One-command demo, lean package, region/adapter contracts, contributor entry Previous release
v0.1.4 Data-root migration, storage policy, and verified deployment metadata Previous release
v0.1.3 Version metadata alignment and release consistency Previous 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.6 release notes, v0.1.5 release notes, v0.1.4 release notes, 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

Metadata

Release files for minxiong-hydrocast 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minxiong-hydrocast 0.1.6
File Size Uploaded
minxiong_hydrocast-0.1.6.tar.gz 227.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minxiong-hydrocast 0.1.6
File Interpreter ABI Platform
minxiong_hydrocast-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 445.1 kB

Release files / minxiong_hydrocast-0.1.6.tar.gz

Download URL minxiong_hydrocast-0.1.6.tar.gz
Size 227.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c444f8cb851dd18202861db0bbad6ea528bf0f2c6965e9c8b3b1372ebff9e540
BLAKE2b-256 checksum
How to use checksums
d38f80c2e5388f5202076e66c3cb95195a6bd91da4a5dbae761bb61a07767038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / minxiong_hydrocast-0.1.6-py3-none-any.whl

Download URL minxiong_hydrocast-0.1.6-py3-none-any.whl
Size 217.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66a072440b30de602885a7e3a32792e30a21350582dfb7933b72677c17c11f7c
BLAKE2b-256 checksum
How to use checksums
3e74ded6807277465a6e889cabb66910b6712b7ea9d9f43fdbf9f40ab3410ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page