Water Survey of Canada (WSC) operates ~2,000 active hydrometric stations across Canada. This app gives you instant, browser-based access to all of them — no software to install, no local database to maintain. It pulls live data from Environment and Climate Change Canada's national HYDAT database via their OGC API, runs analyses on the fly, and delivers publication-ready results.
Try it now → ws-cprep.vercel.app
- Interactive map of all ~2,000 WSC stations (OpenStreetMap + satellite basemap toggle)
- Colour-code markers by mean annual discharge, record length, or drainage area
- Search & filter by station name, ID, province, or active/historical status
- Favourites — bookmark stations for quick access
- Full daily discharge or water-level record for any station
- Pan/zoom timeline, date-range selector
- Annual peak event markers overlaid on the chart
- Download raw data as CSV
- Decompose total discharge into baseflow (groundwater) and quickflow (storm runoff)
- Two industry-standard digital filters:
- Lyne & Hollick (1979) — 3-pass recursive filter (α = 0.925)
- Eckhardt (2005) — two-parameter filter (a = 0.98, BFImax = 0.80)
- Live Baseflow Index (BFI) readout; adjust parameters and see the chart update instantly
- All computation runs client-side — no extra API call
- Ranks every daily value from highest to lowest and plots exceedance probability on a log scale
- Q10, Q50, Q90 markers; log-scale discharge axis
- Essential for environmental flow assessments and water allocation studies
- Mean monthly discharge averaged across the full station record
- Q10–Q90 uncertainty band reveals seasonal variability
- Useful for identifying snowmelt peaks, summer low-flows, and irrigation demand periods
- Descriptive statistics: mean, median, standard deviation, CV, min, max
- Record length and data completeness
- Annual peak statistics
- Mann-Kendall test — non-parametric, robust for skewed hydrological records
- Sen's slope — magnitude of trend in m³/s per year (or m/yr for water level)
- p-value and significance assessment at α = 0.05
- Annual peaks trend tested separately from daily flow trend
Fits multiple probability distributions to the Annual Maximum Series (AMS):
| Distribution | Notes |
|---|---|
| GEV | Generalised Extreme Value — most widely used for floods |
| Gumbel | Special case of GEV; common in older Canadian practice |
| LP3 | Log-Pearson Type III — Canadian/US engineering standard |
| LN2 | 2-parameter Lognormal |
| Pearson III | Generalised gamma family |
- Parameter estimation: L-moments (default) or Maximum Likelihood (MLE)
- Model selection: AIC / BIC + K-S goodness-of-fit test
- 90% bootstrap confidence intervals on all quantile estimates
- Design flood table for T = 2, 5, 10, 20, 25, 50, 100, 200, 500 years
- Choice of Weibull, Hazen, or Cunnane plotting positions
- Option to exclude provisional/estimated years from the fit
- Uses every independent peak above a user-selected threshold — 3–5× more data than AMS
- Threshold: percentile slider (50–99%) or manual m³/s entry
- Independence gap filter: 3, 7, 14, or 30 days minimum separation
- Generalised Pareto Distribution (GPD) fitted by L-moments (closed-form, no iteration)
- Poisson process assumption links exceedance rate to return periods
- Automatic warning if fewer than 15 peaks are selected
- Each station has a
/reportpage assembling all key analyses - Sections: station metadata · hydrograph · FDC · annual regime · peaks · frequency curve · design flood table · annual statistics · trend summary
- One-click Print / Save PDF via the browser's native print dialog
- Print-optimised layout: nav/buttons hidden, charts rendered static, page breaks between sections
Every analysis tab includes an expandable "About this analysis" panel explaining:
- The method in plain English
- Key assumptions
- Peer-reviewed references
┌─────────────────────────────────────────────────────────┐
│ Browser (client) │
│ │
│ Next.js 16 · React · TypeScript · Tailwind · Plotly │
│ Leaflet · Mann-Kendall · Baseflow · POT/GPD │
│ (all client-side) │
└────────────────┬────────────────────┬───────────────────┘
│ /api/* │ /api/stations/*/frequency
▼ ▼
┌───────────────────────┐ ┌────────────────────────────┐
│ Next.js API routes │ │ Python FFA service │
│ (Vercel serverless) │ │ FastAPI · lmoments3 │
│ │ │ scipy · numpy │
│ Proxies ECCC OGC API │ │ (Docker on Render) │
└───────────┬───────────┘ └────────────────────────────┘
│
▼
┌───────────────────────┐
│ ECCC OGC API │
│ api.weather.gc.ca │
│ (live HYDAT data) │
└───────────────────────┘
No local database required. All station and daily data comes from ECCC's public OGC API. Only ~3.3 MB of station metadata is bundled with the app (public/data/).
git clone https://github.com/adilch/WSCprep.git
cd WSCprepcd ffa-service
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000The FFA service will be running at http://localhost:8000.
You can verify it at http://localhost:8000/health.
Open a second terminal:
cd web
npm installCreate a .env.local file in the web/ directory:
FFA_SERVICE_URL=http://localhost:8000
OGC_BASE_URL=https://api.weather.gc.caThen start the dev server:
npm run devOpen http://localhost:3000 in your browser.
- Fork this repository
- Go to vercel.com → Add New Project → import your fork
- Set Root Directory to
web - Add environment variable:
FFA_SERVICE_URL=<your-render-service-url> - Deploy — Vercel handles the rest
- Go to render.com → New Web Service
- Connect your forked repository
- Set Root Directory to
ffa-service - Set Runtime to Docker
- Add environment variable:
ALLOWED_ORIGINS=https://<your-vercel-domain>.vercel.app - Deploy
Free tier note: Render's free tier spins down after 15 minutes of inactivity. The first flood frequency request after a quiet period may take ~30 seconds to wake the service.
| Layer | Technology |
|---|---|
| Frontend framework | Next.js 16 (App Router, TypeScript) |
| Styling | Tailwind CSS |
| Charts | Plotly.js |
| Maps | Leaflet + React-Leaflet |
| FFA engine | Python · FastAPI · lmoments3 · SciPy |
| Client-side analysis | TypeScript (Mann-Kendall, Baseflow, POT/GPD) |
| Data source | ECCC OGC API (live HYDAT) |
| Frontend hosting | Vercel |
| Backend hosting | Render (Docker) |
Station data and daily discharge/water-level records are sourced from the National Hydrometric Program, operated by Environment and Climate Change Canada (ECCC) through the Water Survey of Canada.
- HYDAT database: open.canada.ca
- OGC API: api.weather.gc.ca
Data is provided under the Open Government Licence – Canada.
This project is released under the MIT License.



