LSTM for Water Level Prediction

The motivation

Water extraction in sensitive wetlands can be damaging to the environment if not regulated well. In this project, we looked at an ecologically sensitive moor in Germany (the exact location is not disclosed due to confidentiality). The study area is influenced by the pumping of nearby wells for drinking water production, and therefore, an accurate model is critical to calculate the safe limit for the groundwater extraction and to preserve the moor ecologically. Because this moor is connected to a complex underground aquifer, it is challenging to understand and model the system. Due to the poor understanding of the modelled system, a physics-informed machine learning model can be designed to provide reliable and physically-sound predictions of the swamp water level.

The LSTM model

Because we are interested in predicting the changes in the water level for a longer time horizon, we chose a Long Short-Term Memory (LSTM) model. A single LSTM cell has several gates, namely the forget gate, input gate, and output gate (see the sketch above). The forget gate learns whether to keep or discard a piece of information from the previous time steps, given the new information coming into the model. The input gate learns whether to add the new information to update the information from the previous time steps. The output gate then calculates the value of the next hidden state. Intuitively, the cell state in an LSTM serves as a memory of the model, carrying information from the past with minimum disruptions. Thanks to this, LSTM also reduces the vanishing gradient effect, making it more suitable to handle data with long prediction horizon.

For our modeling purpose, we devised an LSTM model as shown in the sketch below. As an initial condition, the swamp water level is encoded to be interpreted as an initial hidden state of the model. The same LSTM cell is then repeated for each time step, with the hidden states going further through a decoder to obtain the swamp water level prediction. At each time step, preprocessed inputs such as precipitation, evapotranspiration, as well as the well pumping rates are provided to the LSTM cell as additional inputs.

The results and comparison with a numerical flow model

The plots above present the swamp water level measurement (blue lines) compared with various model inputs and prediction (red lines). The top left plot shows the precipitation, the top right plot shows the evapotranspiration data, the bottom left plot shows the pumping rates, and the bottom right plot shows the LSTM prediction in red. We also annotated two major pumping events in the plot. The first pumping event happened during low precipitation and high evapotranspiration, leading to a huge drop in the swamp water level. In contrast, the second pumping event happened during high precipitation and low evapotranspiration, leading to a relatively stable swamp water level. It is very important that the model successfully captures the effect of these major pumping events in combination with the precipitation and evapotranspiration data, showing that we have a model that produces reliable predictions. Additionally, we compared the LSTM prediction with a calibrated numerical flow model. As shown in the plots below, LSTM produces better predictions compared to the numerical flow model especially during the peaks, further confirming that the model is accurate.

Checking physical plausibility

To further ensure physical plausibility of the model predictions, we included physics-based regularizations in the loss function definition. One example is to penalize the model if it predicts a lower ground water level with a lower well pumping rate. A quick check of this condition is shown in the plot below. By keeping all the other variables constant, we changed the pumping rate input to a lower and higher value. The results show that our model adheres to this physics-based rule, by predicting a higher water level with a lower pumping rate, and vice versa. Additional conditions are also included based on the precipitation and evapotranspiration data (the water level should be higher with higher precipitation, and lower with higher evapotranspiration).

TLDR

In this project, we designed an LSTM model to predict the swamp water level in a sensitive environment. The LSTM model is suitable for the long prediction horizon, and is able to capture combined effects of various input variables, such as well pumping rate, precipitation, and evapotranspiration. As additional constraints, we included physics-based regularizations in the model, so that the predictions are physically consistent and plausible. So far, the model received precipitation and evapotranspiration data that were already measured in the past. For prediction purpose, however, these measurement data are not yet available, and we have to rely on another predictions of these variables. For future works, it would be interesting to check if the model performance is severely compromised when we use predicted data provided by the German Weather Service (DWD), instead of past measurement values.

Further reading

Related slides: Related code: