Environmental and climatic covariates
At each 50-m long stream site, a line was drawn perpendicular to the channel every 10 m and at every 25 centimeters of the line, we took sediment samples for later analysis in the laboratory. The sediments were identified according to grain size following the Wentworth scale (Wentworth, 1922). We identified four sediment classes: (i) mud (< 0.00006 mm), (ii) silt (>0.0039 mm and <0.0625 mm), (iii) sand (>0.0625 mm and <2 mm), and (iv) gravel (>2 mm). We measured the percentage of each sediment class in each site. We then used the percentage of sediment classes to estimate the sediment heterogeneity in each site, which was calculated using the coefficient of variation (CV, the ratio between the standard deviation SD and the mean μ [SD/μ]) of the percentage of the sediment types (Stein & Kreft, 2015). In addition, we measured the depth of each stream site (m) in situ by using a ruler. Depth was measured at the same points as we sampled substrate.
To determine site water quality, we measured dissolved oxygen (DO, mg L-1), total phosphorus (TP, µg L-1), total nitrogen (TN, µg L-1), and conductivity (uS/cm). The sampling method for each variable is provided in the Supplementary Methods. To evaluate patterns of water quality variation, we used a principal component analysis (PCA) approach (Monteiro-Júnior et al., 2014). The first PCA axis synthesized the major source of variation in the original four variables (55.8%), and this axis was negatively correlated with DO (Spearman correlation; r = –0.560), and positively correlated with TP (r = 0.510), TN (r = 0.531), and conductivity (r = 0.377; Figure S3). Thus, the distribution of samples along the first PCA axis indicates that as nutrients and conductivity increased, dissolved oxygen decreased, representing a proxy for water quality deterioration.
To estimate the key climatic predictors for each stream site, we determined mean annual temperature [MAT] and mean annual precipitation [MAP]. Both MAT and MAP data were obtained from the WorldClim 2.0 database (http://www.worldclim.org) at a 1-km2 spatial resolution. MAT and MAP are the most common climatic metrics used in ecological studies and are known to be corrected with biodiversity variation (Patrick et al., 2019; García-Girón et al., 2021).