## 4 Methods and Preliminary Analysis
The Pearson correlation matrix for the analyzed data is presented in a graphical correlation matrix, where the size of circles is related to the value of the Pearson correlation between segments; hot colors means positive, while cold colors stand for a negative correlation (Figures 8-10). High, positive Pearson correlations can indicate that there is a similar fluctuation of time series of the analyzed segments. We have also analyzed the Pearson correlation matrix for the time series of the groundwater levels corresponding to summer (Figure 9) and winter seasons (Figure 10). Figure 7: The detrended groundwater level fluctuation. The hydrological year is marked by the black line. Additionally, the summer/winter seasons are indicated with red broken lines. Figure 8: Pearson correlation matrix for time series of detrended groundwater levels corresponding to the hydrological years (HYs). Figure 9: Pearson correlation matrix for time series of detrended groundwater levels corresponding to the winter seasons of the HYs. The correlation analysis showed, that there are several groups of HY with similar properties. Within these groups, the correlation is very high, whereas between HYs from different groups, the correlation is much smaller. Correlation coefficients are higher for seasons than for whole years and winter seasons are much more self-similar than summer seasons. One may therefore conclude that the relatively weak annual correlation results from differences in the summer seasons. An alternative approach to find a similarity between time series is based on clustering. The agglomerative clustering (AHP) is the most popular type of hierarchical clustering. Based on the similarity of the objects, AHP groups the objects into clusters [54] in a \"bottom-up\" approach. This means that each observation starts in a single-element cluster, and if two clusters are the most similar, they are merged as one moves up the hierarchy. There are many cluster agglomeration methods. In this paper we use the Ward linkage criterion, which minimizes the total variance within clusters. The sum of squares metric is described by the following formula [55]:  
\[d(r,s)=\sqrt{\frac{2n_{r}n_{s}}{(n_{r}+n_{s})}||\overline{x}_{r}-\overline{x}_ {s}||_{2}}, \tag{3}\]  
where \(r\) and \(s\) are the analyzed clusters, \(n_{r}\) and \(n_{s}\) are the number of elements in clusters \(r\) and \(s\) respectively, \(\overline{x}_{r}=\frac{1}{n_{r}}\sum_{i=1}^{n_{r}}x_{ri}\) and \(\overline{x}_{s}=\frac{1}{n_{s}}\sum_{i=1}^{n_{s}}x_{si}\) are the centroids of clusters \(r\) and \(s\), respectively and \(||\cdot||_{2}\) is the Euclidean distance. In order to estimate the number of clusters, we use the gap statistic [56]. One of the methods to present the results of the AHP is a dendrogram, which is a graphical representation of the clusters produced by the corresponding analyses. As input data, we provide the same segments as for the Pearson correlation matrix. The dendrogram and year-to-year time series are clustered into 5 groups (Figures 11 and 12, respectively). If there is more than one value in the cluster, they have been marked with color, otherwise they are black. By analogy, AHP clustering has been applied to seasons of the analyzed HYs (Figures 13 and 14 for winter seasons and for summer seasons Figures 15 and 16). One may conclude that both techniques (correlation and clustering) showed that the time series corresponding  
Figure 10: Pearson correlation matrix for time series of detrended groundwater levels corresponding to the summer seasons of the HYs. to the HYs might be very different. The same we observe for winter and summer seasons. Moreover, it might happen that time series of groundwater levels of the HY is different for a half of the year only. This confirms the need to analyze the time series by seasons. Figure 11: Dendrogram for time series of detrended groundwater levels corresponding to the HYs from applying the AHP clustering.