pangeo_lstm_example icon indicating copy to clipboard operation
pangeo_lstm_example copied to clipboard

Example notebook, showing how to use LSTMs for rainfall-runoff modeling

Update August 2022

The pangeo binder server is currently offline due to abuse by crypto miners, see https://github.com/pangeo-data/pangeo-binder/issues/195 It is unclear when/if the pangeo binder server will be back online. Minimal code changes should be required to run this notebook locally. For more tutorials (and an entire open source Python library), you might be interested to check out my open source library NeuralHydrology.

Rainfall-runoff modelling using LSTMs

Binder

This is an example notebook on how to use LSTMs for rainfall-runoff simulations. We make use of the PyTorch deep learning library and the CAMELS data set

Run on Pangeo cluster

Click the launch binder button/icon above to run the notebook on the Pangeo server and to walk through this example without the need of installing anything.

Run locally

  1. Download the CAMELS data set from here

  2. Download and extract or clone the run_local branch git clone -b run_local --single-branch [email protected]:kratzert/pangeo_lstm_example.git

  3. (Optionally) Create conda environment from the environment.yml file in the binder/ directory. If you have a GPU available, make sure to install the PyTorch GPU version.

  4. Start Jupyter Notebook/Lab and make sure to change the CAMELS_PATH in the first code box to your local CAMELS path.

Related article

In our paper "Rainfall–runoff modelling using Long Short-Term Memory (LSTM) networks" we tested the LSTM on various basins of the CAMELS data set. This notebook shows how to replicate experiment 1 of the paper in which one LSTM is trained per basin. Note: This is not an exact replication of the model setup, but can be easily extended to the settings of the paper.

If you use this repository in your work, please cite:

Kratzert, F., Klotz, D., Brenner, C., Schulz, K., and Herrnegger, M.: Rainfall–runoff modelling using Long Short-Term Memory (LSTM) networks, Hydrol. Earth Syst. Sci., 22, 6005-6022, https://doi.org/10.5194/hess-22-6005-2018, 2018.