Hostname: page-component-74656f9884-skzmx Total loading time: 0 Render date: 2026-11-05T15:38:06.405Z Has data issue: false hasContentIssue false

Predicting stream water temperature: A data-driven approach highlighting the impact of riparian vegetation

Published online by Cambridge University Press:  23 September 2026

Simon Walther
Affiliation:
HEIG-VD School of Engineering and Management Vaud, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland
Benoît Hohl
Affiliation:
HEIG-VD School of Engineering and Management Vaud, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland
Pauline Lourenço
Affiliation:
HEPIA, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland Maison de la Rivière, Switzerland
Hector Fabio Satizabal Mejia
Affiliation:
HEIG-VD School of Engineering and Management Vaud, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland
Jean-François Rubin
Affiliation:
HEPIA, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland Maison de la Rivière, Switzerland Faculty of Biology and Medicine, UNIL , Switzerland
Andres Perez-Uribe*
Affiliation:
HEIG-VD School of Engineering and Management Vaud, HES-SO University of Applied Sciences and Arts Western Switzerland, Switzerland
*
Corresponding author: Andres Perez-Uribe; Email: andres.perez-uribe@heig-vd.ch

Abstract

Stream water temperature strongly influences aquatic ecosystem health, affecting dissolved oxygen, species distributions, and thermal stress for sensitive taxa. We present a data-driven framework to predict water temperatures across rivers in the Canton of Vaud, Switzerland, explicitly quantifying the influence of riparian vegetation. Meteorological and topographic features were extracted at each water temperature station. Vegetation features were derived from satellite imagery data, using Vegetation Height Models (VHM) and Specific Leaf Area Vegetation Index (SLAVI), and aggregated along upstream river segments to capture the influence of riparian zones on water temperature. These features were incorporated into a machine-learning model using grouped inputs with Softmax-based weighting for meteorology and a Gaussian attention layer for vegetation. Spatial cross-validation ensured realistic generalization. The model achieves a median mean absolute error of 1.3 °C for daily 90th percentile water temperatures. Model analyses show that dense riparian vegetation can reduce predicted stream temperatures by nearly 3 °C on warm days. Moreover, the spatial influence of vegetation varies with river slope: in flatter reaches, vegetation close to the water temperature station exerts the strongest cooling effect, whereas in steeper reaches, vegetation located further upstream becomes more influential, consistent with faster flow transporting thermal signals downstream. These results underscore the importance of incorporating spatially explicit riparian vegetation metrics in predictive models. The framework offers actionable insights for river management, showing that targeted riparian preservation or restoration, even in narrow corridors, can effectively mitigate thermal stress and support climate adaptation strategies.

Information

Type
Application Paper
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Figure 1. Location of water temperature stations in the Canton of Vaud. The inset (top left) displays the map of Switzerland, with a red rectangle indicating the study area’s geographic extent.Figure 1. long description.

Figure 1

Figure 2. Data availability for each water temperature station. Black means water temperature measurements are available.

Figure 2

Table 1. Meteorological features from MeteoSwiss used in this study, including their code and unitTable 1. long description.

Figure 3

Figure 3. (a) Buffer zones (characterized by length and width, with left and right banks averaged together) used to compute vegetation features along the river. (b) Example on an actual satellite image showing the different buffer zones for a given segment of the river. (c) Example of upstream vegetation for one water temperature station (data from year 2013). The darker the green color, the higher the SLAVI-VHM.Figure 3. Long description.

Figure 4

Figure 4. Schematic representation of the softmax-based weighting used to summarize meteorological feature groups. This scheme represents one group. Each group is handled as an independent unit. Features within a group range from X1$ {X}_1 $ to Xn$ {X}_n $.Figure 4. long description.

Figure 5

Figure 5. Architecture of the upstream vegetation Gaussian attention layer. The layer takes two inputs: the upstream vegetation represented as a matrix, and the water temperature station slope, which determines the shape and position of the Gaussian. The model learns eight parameters, including the Gaussian standard deviations (defining width and height), the positions along both horizontal and vertical axes, and the biases. The resulting attention matrix is subsequently multiplied with the upstream vegetation matrix, effectively assigning greater weight to the most relevant riparian vegetation zones. In this specific example, the attention matrix, dependent on the station slope, assigns higher weights to vegetation located approximately 140 to 160 meters upstream of the water temperature station, with a width of 4 m (highlighted in yellow in the figure). Finally, a Global Average Pooling layer produces a single summary value representing the riparian vegetation.

Figure 6

Figure 6. Overall architecture of the model. Each group of features is summarized by a single value representing a weighted average of all features within the group. A more complete description of meteorological individual features can be found on Table 1. For meteorological groups, feature weights are constrained by the Softmax function, which transforms raw scores into positive weights that sum to one, ensuring an interpretable relative contribution of each variable. For vegetation features, a Gaussian attention module assigns spatially structured weights based on a two-dimensional Gaussian function whose parameters are modulated by slope, enabling context-aware spatial focus on the most relevant riparian zones. Four additional features (slope, altitude, and the sine and cosine encoding of the day of the year) are not grouped and are directly concatenated with the group summaries. The slope variable therefore plays a dual role: it modulates the Gaussian attention mechanism and is also provided as a direct input to the concatenated feature vector. The resulting vector is passed to an MLP composed of two hidden layers, which performs nonlinear transformations to predict the daily 90th percentile stream water temperature. The weights are learned by the model during model training, as described in Section 3.2.

Figure 7

Figure 7. Boxplot of the Mean Absolute Error (MAE) across the 10 spatial cross-validation folds. The model attained a median MAE of 1.31 °C. For comparison, a recent review of machine learning studies on stream water temperature reported testing MAE values with an interquartile range of 0.55–1.53 °C and a median of 1.21 °C across 13 studies (Corona and Hogue, 2025).Figure7. long description.

Figure 8

Figure 8. Visualization of the riparian vegetation segment’s attention on all data as a function of the slope. The more yellowish the color, the higher the focus of the model on that particular upstream segment.

Figure 9

Figure 9. Mean model response of predicted water temperature (Tw$ {T}_w $) to variations in the vegetation feature SLAVI-VHM, showing cooler temperatures with increasing vegetation density. The upper 10% of the warmest days were used.Figure 9. long description.

Figure 10

Figure 10. SHAP analysis of feature impacts on predicted water temperatures. Color indicates feature value (bluer = lower, pinker = higher), and horizontal position shows contribution to the prediction. SLAVI-VHM is the upstream riparian vegetation group. The seven other features mentioned in the figure are: slope, ordinal day (sin encoded), hydrometeorology, cloud, snow, pressure, and wind.Figure 10. long description.