Let's work together
Back

Teaching a flood model to hear one river.

Same-day streamflow nowcasting for local extremes.

Time-Series ML · Hydrological Nowcasting · ML Engineering·SEAS 2025 team origin · Continued independently·↗ live dashboard
Python · TensorFlow/Keras · Pandas · Scikit-learn

linkOrigin

DeepFlood began as a team project at SEAS. After the program, I continued the project independently, refining the data pipeline, validation design, peak-sensitive training strategy, baseline comparison, and evaluation dashboard. This led to a more rigorous research question:

Can a basin-specific time-series model preserve rare local streamflow extremes without leaking future information into validation?

The result is a same-day streamflow nowcasting prototype specific to the Long Đại basin, Quảng Bình, Vietnam.

linkProblem

Extreme hydrological events create an imbalanced regression problem. Most observations represent normal flow conditions, while the most important events are rare peaks.

Time-series experiments also require careful validation design because random splits and preprocessing that uses full-dataset statistics can introduce future information into historical evaluation. This can inflate apparent performance without reflecting real predictive skill.

linkData & Method

Each prediction uses a seven-day input window of hydrometeorological observations. The model estimates streamflow on day tt using meteorological observations available through day tt and streamflow observations available before day tt.

The features derive from three stages of processing:

Raw observations
Precipitation (prcp) · Max/min temperature (tmax, tmin) · Solar radiation (srad) · Vapor pressure (vp) · Day length (dayl) · Historical streamflow
Engineered signals
Rolling rainfall windows · Seasonality indicators · Lagged streamflow · Temporal statistics
Model input
39 features × 7-day window · target-derived streamflow features use strictly lagged observations
XtR7×39X_t \in \mathbb{R}^{7 \times 39}
where 7 = temporal sequence length (days) and 39 = engineered hydrometeorological features

The sequence is processed through a sequential architecture:

XtConv1D64BiLSTM128BiLSTM64Temporal AttentionQ^tX_t \rightarrow \mathrm{Conv1D}_{64} \rightarrow \mathrm{BiLSTM}_{128} \rightarrow \mathrm{BiLSTM}_{64} \rightarrow \mathrm{Temporal\ Attention} \rightarrow \hat{Q}_t

The bidirectional layers operate only within the observed input window. They do not access observations after prediction time tt, and target-derived streamflow features use historical lags only.

linkRefinement

The continued work focused on controlling future data leakage risk, refining feature generation, enforcing chronological validation, testing peak-sensitive weighting, and evaluating reproducible artifacts.

To penalize large flow errors during training, samples are weighted by flow magnitude:

wi=1+30(yiymax,train)w_i = 1 + 30\left(\frac{y_i}{y_{\max,\mathrm{train}}}\right)
1wi311 \le w_i \le 31 within the training target range

Here yiy_i is the training target for sample ii and ymax,trainy_{\max,\mathrm{train}} is the maximum streamflow in the training period. High-flow observations become progressively more influential during optimization. This places greater emphasis on large flow errors, but it may also increase average absolute error on ordinary observations. The current experiment does not isolate its individual contribution.

linkValidation

To prevent temporal leakage, evaluation enforces a strict chronological split:

EARLIERLATER
Training period · 70%
Validation period · 30%
Validation period contains 107 chronological observations. The same period was used for checkpoint selection.
SafeguardWhat it prevents
Chronological splitFuture observations being randomly mixed into the training set
Train-only scalingFuture distribution information entering preprocessing scalers
Strictly lagged streamflowDay-T target information leaking into day-T model input features

linkResults

Performance comparison across the 107-observation validation period:

MetricDeepFloodPersistence baseline
MAE130.8 m³/s126.9 m³/s
RMSE148.1 m³/s312.8 m³/s
NSE0.726−0.222

DeepFlood reduces RMSE by approximately 52.6% relative to persistence. DeepFlood MAE is approximately 3.0% higher than persistence.

Diagnostic on the largest event in the validation period:

Validation peak diagnosticValue
Observed peak2,576.39 m³/s
Predicted peak2,800.68 m³/s
Magnitude error+8.7%
Timing lag0 days

This diagnostic covers a single event and is not evidence of reliable peak performance across extreme events.

linkInterpretation

DeepFlood does not outperform persistence on every metric. Persistence achieves slightly lower MAE because streamflow often changes gradually between consecutive days, so the persistence assumption remains competitive under normal conditions.

DeepFlood substantially improves RMSE and NSE. This reflects the intended trade-off: peak-sensitive training places more weight on large flow errors during optimization, which emphasizes high flow deviations at the cost of a small increase in average absolute error on ordinary observations. The metrics emphasize different error behavior. MAE treats all errors equally, while RMSE penalizes large deviations more heavily.

linkLimitations

Evidence supportsEvidence does NOT establish
Same-day streamflow nowcasting for Long ĐạiMulti-day forecasting skill
Chronological validation period performancePerformance on an independent test set
Basin-specific resultsCross-basin generalization
Precomputed evaluation dashboardOperational warning deployment
Peak-sensitive behavior during validation periodReliability across all extreme events
Comparison against a persistence baselineSuperiority over simpler ML models or alternative architectures

linkArtifact

Evaluation dashboard: https://deepflood.haidangtrih.me/

Predictions shown are precomputed evaluation outputs. The dashboard visualizes hindcast results and is not an operational inference service.