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.

Project website and documentation · Quick start · API reference · Documentation index

Status: Operational Prototype / Data and Model Development. The observation service is usable on a localhost-only deployment. The label-free radar dataset-building protocol is published: future observed radar frames provide targets, and weather regimes remain unknown. Forecast publication and automated risk notifications retain their existing acceptance gates.

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 datasets with source/frame provenance, fixed splits and observed-frame targets;
  • 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/>source QA · checksums"]
    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. The fixed radar-building protocol requires no manual weather or flood annotations. The separate curated candidate-review workflow and operational model/alert gates remain unchanged.

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.

Dated verification evidence

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.

The later 2026-09-12 WRA freshness investigation recorded an unchanged flood-sensor observation timestamp from September 2 despite successful fetches. Readiness correctly failed closed. See WRA freshness evidence. Neither the July verification nor the September incident establishes today's private runtime state. The public documentation site is static and does not connect to that runtime.

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

Software and protocol artifacts have separate version lines. Install the software package for the CLI/service; use the independent protocol release for the manifest, fixtures, exact source inventory and dataset-building citation.

Version Milestone State
v0.1.8 Rolling backtests, offline event replay and archive coverage reports Current software version
v0.1.7 Protocol archive tooling, strict QPE/gauge alignment, public documentation and source provenance Previous software release
v0.1.6 Complete retirement of AIWeatherForecast legacy documentation Previous software 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
dataset-protocol-v0.2.0 Label-free radar dataset-building protocol Published 2026-10-20; source/frame provenance, fixed split, synthetic reconstruction and separate citation; no human annotations required
v0.3.0 Baseline Nowcasting Planned; requires model, label, and lead-time gates

Research feature roadmap

All three research workflows are available in software v0.1.8. None requires manual weather or flood annotations.

Priority Feature Useful result
1 Rolling backtests, #58 Available: persist Persistence/Optical Flow forecasts, score arriving radar targets, retain per-lead metrics and resume without changing saved predictions
2 Offline event replay, #59 Available: replay stored radar and available QPE/gauges with source time, units, datum, missing data and model errors
3 Archive coverage, #60 Available: summarize expected/captured/valid frames and source gaps, separating unavailable URLs from unknown retention

Rolling backtests come first: they turn the current one-off event evaluations into repeatable evidence as new observations arrive. Proposed research windows remain separate from the fixed benchmark; normalization uses training data only. See the feature scope.

See CHANGELOG.md, the v0.1.8 release notes, 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.8

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.8
File Size Uploaded Provenance Actions
minxiong_hydrocast-0.1.8.tar.gz 285.3 kB With provenance Details for minxiong_hydrocast-0.1.8.tar.gz

Built distribution (wheel)

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

Total release size: 548.8 kB

Release files / minxiong_hydrocast-0.1.8.tar.gz

Download URL minxiong_hydrocast-0.1.8.tar.gz
Size 285.3 kB
Tags Source
SHA-256 checksum
How to use checksums
84b655a8e03877e0af6432609bd7ea66685d6f0262185d854ed6b5630e656d36
BLAKE2b-256 checksum
How to use checksums
d757877122d4d6336e755579ce4932d37eeda42ca16d3ca8565966cd85d344be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

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

Download URL minxiong_hydrocast-0.1.8-py3-none-any.whl
Size 263.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11964f2d17d751bc124fc79bb99c6c8003c8538c2a0a3fd907879d89868c5634
BLAKE2b-256 checksum
How to use checksums
3107f670c1040ba680e3beec23e74c2309ec9aef55909eabe800ffc7e948c907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 21, 2026.

Transparency log

Security for minxiong-hydrocast 0.1.8

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for minxiong_hydrocast-0.1.8.tar.gz

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 Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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