Published September 27, 2025 | Version v2
Computational notebook Open

LSTM Rainfall–Runoff Modeling Tutorial (Minimal Implementation in 200 Lines with CAMELS)

Description

This tutorial demonstrates how to build a rainfall–runoff model using an LSTM neural network with only 200 lines of code and minimal dependencies, utilizing the CAMELS dataset and achieving an NSE score of 0.74 on the Daymet forcing dataset.

The tutorial covers data loading, normalization, model construction, training, testing, and result denormalization.

---

If you use this tutorial's data or code, please cite:

Liu, J., Bian, Y., Lawson, K., & Shen, C. (2024). Probing the limit of hydrologic predictability with the Transformer network. Journal of Hydrology, 637, 131389. https://doi.org/10.1016/j.jhydrol.2024.131389

Liu, J., Shen, C., O'Donncha, F., Song, Y., et al. (2025). From RNNs to Transformers: benchmarking deep learning architectures for hydrologic prediction. EGUsphere, 2025, 1-21. https://doi.org/10.5194/egusphere-2025-1706

Files

README.md

Files (44.7 kB)

Name Size Download all
md5:b71b0ea39aaa5d5c3faecfebd2a4c864
6.7 kB Preview Download
md5:471ba5e411458bd0d84bcc64d15076df
38.0 kB Preview Download