Runoff annual distribution mode clustering method based on threshold guidance and average connection
By using a clustering method based on threshold guidance and average connectivity, this paper solves the problems of existing technologies that require manual parameter setting and are sensitive to outliers in the clustering of runoff annual distribution patterns. It realizes automated, robust and accurate clustering identification of runoff data, adapts to the characteristics of runoff percentage data, and improves the stability and accuracy of clustering.
Patent Information
- Application Number
- CN202610089778.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-19
AI Technical Summary
Existing clustering methods for annual runoff distribution patterns require manually preset parameters, are sensitive to outliers, and are not suitable for runoff percentage data, resulting in insufficient clustering accuracy and poor stability.
A threshold-guided and average connectivity-based clustering method is adopted. Outliers are detected by Mahalanobis distance, and the threshold and number of clusters are adaptively determined. Euclidean, cosine and Manhattan distance metrics are combined, and the average connectivity criterion is used for clustering. The clustering quality is evaluated by quantitative indicators such as silhouette coefficient and Davidson-Baudin index.
It achieves automated, robust, and accurate clustering identification of intra-annual runoff distribution patterns, adapts to runoff data characteristics, has strong anti-interference capabilities, and provides high stability and accuracy in clustering results.
Smart Images

Figure CN122065060A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hydrology and water resources technology, specifically a clustering method for intra-annual runoff distribution patterns based on threshold guidance and average connection. Background Technology
[0002] The annual runoff distribution pattern refers to the proportional distribution of runoff across different time periods (monthly, decadal, etc.) within a year. It directly determines the utilization efficiency of regional water resources and serves as a core basis for water conservancy project planning and design, optimal allocation of water resources, and ecological flow assurance. For example, agricultural irrigation needs to be matched with periods of abundant runoff, and hydropower station scheduling needs to formulate power generation plans based on the annual runoff variation patterns. Therefore, accurately identifying the annual runoff distribution pattern has significant practical engineering implications.
[0003] Existing clustering methods for intra-annual runoff distribution patterns mainly rely on traditional clustering algorithms, including the following categories: (1) K-Means clustering algorithm: The number of clusters K needs to be preset manually. The reasonable number of clusters for the annual runoff distribution pattern is significantly affected by regional climate, topography and underlying surface conditions. Manual setting is likely to result in too many or too few clusters, which is out of sync with the actual hydrological pattern. Moreover, the algorithm is sensitive to the initial cluster center and is prone to getting trapped in local optima, resulting in poor stability of the clustering results.
[0004] (2) Traditional hierarchical clustering algorithm: Clustering is achieved by merging or splitting clusters step by step, but it lacks clear distance threshold control and is prone to chain clustering (i.e., samples with low similarity are forcibly assigned to the same cluster), making it difficult to adapt to the characteristics of runoff distribution percentage data; at the same time, it does not consider the impact of outliers, and the abnormal samples caused by extreme hydrological events (such as catastrophic floods and continuous droughts) will seriously distort the clustering structure.
[0005] (3) DBSCAN clustering algorithm: It relies on manually setting the neighborhood radius and the minimum number of samples in the neighborhood of the core point. The parameters are difficult to adjust and it has poor adaptability to sparsely distributed runoff samples. It is easy to misjudge reasonable niche distribution patterns as noise points.
[0006] (4) Spectral clustering algorithm: It is sensitive to the construction method of the similarity matrix. The selection of similarity measure for runoff percentage data lacks a unified standard, which can easily lead to distortion of the clustering structure. It requires manual preset of the number of clusters and has weak anti-interference ability against outliers. Extreme hydrological events will destroy the symmetry and rationality of the similarity matrix, thus affecting the clustering results.
[0007] In addition, existing methods generally suffer from the following common defects: (1) The distance metric and connectivity criteria were not optimized for the percentage standardization characteristics of runoff data, resulting in insufficient clustering accuracy; (2) There is a lack of systematic outlier handling mechanisms, and the problem of sample distortion caused by extreme hydrological events has not been effectively solved; (3) The quality assessment of clustering results is singular, relies heavily on subjective judgment, lacks quantitative indicators, and is difficult to verify the reliability of pattern recognition.
[0008] Therefore, existing technologies cannot meet the requirements for automated, robust, and highly accurate intra-annual runoff distribution pattern clustering. There is an urgent need for a clustering technology that adapts to the characteristics of runoff data, requires no manual intervention in key parameters, and has strong anti-interference capabilities. Summary of the Invention
[0009] The technical problem to be solved by this invention is to provide a clustering method for intra-annual runoff distribution patterns based on threshold guidance and average connection. This method can solve the problems of existing clustering methods that require manual parameter setting, are sensitive to outliers, and are not suitable for runoff percentage data. By adaptive threshold and cluster number determination, targeted outlier processing, and percentage data adaptation design, this method achieves automated, robust, and accurate clustering identification of intra-annual runoff distribution patterns, providing reliable technical support for hydrological analysis.
[0010] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a clustering method for intra-annual runoff distribution patterns based on threshold guidance and average connectivity, comprising the following steps: S1. Runoff data preprocessing: Runoff data preprocessing a. Collect multi-year, time-period (daily) runoff observation data for the target area. The data must be continuously observed and have no large number of missing values (the proportion of missing values is ≤5%, which can be filled by linear interpolation). b. Divide the data into units according to the calendar year, and for each year, calculate the cumulative value of runoff for each month (or ten days). c. Calculate the percentage of monthly (or ten-day) runoff to the total annual runoff using the following formula: ; In the formula, r ij Q represents the percentage of runoff in the j-th time period of the i-th year; ij Let n be the runoff in the j-th period of the i-th year; n is the number of time periods (monthly scale n=12, ten-day scale n=36).
[0011] d. Construct an m×n dimensional sample matrix X, where m is the number of valid years (sample size) and n is the number of time periods (feature dimension). S2. Outlier Detection and Handling: The Mahalanobis distance outlier detection method involves the following steps: a. Calculate the mean vector μ and covariance matrix ∑ of the sample matrix X; b. Solve for the inverse matrix ∑ of the covariance matrix using pseudo-inverse operations. 1 (To avoid calculation failures caused by singularity of the covariance matrix); c. Calculate the Mahalanobis distance for each sample, i.e. ; d. Set the outlier detection threshold T (range 2-4, default 2), which will satisfy d. M >T×median(d M Samples with a median value (m' is the median) are identified as outliers and removed from matrix X to obtain a clean sample matrix X' (number of samples m' ≤ m). S3, Distance matrix calculation: a. Select a distance metric that is suitable for runoff percentage data: ① Euclidean distance (default method): ; In the formula, x ik Let be the k-th feature value of sample i, that is, the percentage of runoff in the k-th time period of the i-th year; ② Cosine distance: ; ③Distance from Manhattan: ; b. If the number of samples m' > 50, parallel computing mode can be enabled: Create a parallel loop to calculate the upper triangular part of the distance matrix, and then use the symmetry of the distance matrix (d(xi,xj)=d(xj,xi)) to fill the lower triangular part, generating an m'×m' dimensional distance matrix Dist; c. If the number of samples m'≤50, adopt the serial calculation mode and directly calculate the complete distance matrix using the distance formula; S4. Distance threshold D0 is automatically determined: a. Extract the distance matrix D ist Find all the non-repeating upper triangular elements (i.e., D(i,j) where i < j) in the set of non-repeating distances, and obtain the non-repeating distance set D. b. Calculate the smallest non-zero value D in D. min and maximum value D max Ensure that the subsequent threshold D0 satisfies D min <D0<D max ; c. Calculate D0 using a preset threshold selection method. Possible methods include: ① Mean method: D0 = mean(D); ②Median method (default method): D0 = median(D); ③ Percentile method: D0=percentile(D,p) (p is the percentile, the default p=70%, which balances the compactness and diversity of the cluster). ④ Inflection point method: After sorting D, calculate the difference between adjacent elements, and take the distance corresponding to the largest difference as D0; S5, Threshold-guided average connectivity clustering: a. Initialize clusters: Traverse the distance matrix D ist Find the two samples with the largest distance (let's call them sample i and sample j), and use them as seed points for the initial clusters C1 and C2, respectively, i.e., C1={i}, C2={j}; b. Sample iterative allocation: ① Extract the remaining sample set P={1,2,…,m'} (excluding sample i and sample j), and iterate through each sample p in set P; ② For each existing cluster Cc (c=1,2,…,k, where k is the current cluster number), calculate the average distance from sample p to cluster Cc (average connectivity criterion): ; Where |Cc| is the number of samples in cluster Cc, d(x p Let (x, y) be the distance between sample p and sample x within the cluster; ③ Filter the cluster set S={Cc|d(x)} whose average distance is less than D0. p ,Cc) <D0}; ④ If S is empty, then create a new cluster C. k+1 ={p}, the cluster number is updated to k+1; ⑤ If S is non-empty, find the cluster with the smallest average distance in S: if it is unique, add p to the cluster; If multiple clusters have the same average distance, select the cluster with the smallest sample number within the cluster and add p to it; ⑥ Repeat the above steps until all samples have been allocated; ⑦ Mark all abnormal samples and samples in single-sample clusters (with only one sample in the cluster) as noise points; S6. Clustering results output: a. Calculate the cluster center: For each cluster Cc, calculate the mean vector μc of all samples within the cluster as the representative center of the cluster. The calculation formula is as follows: ; b. Clustering quality assessment, calculating three types of quantitative indicators: ① Profile coefficient (SC): ; Where a is the average distance from the sample to other samples within the cluster; b is the average distance from the sample to the nearest outer cluster; The range of SC values is [ [1,1], the closer to 1, the better the clustering effect; ② Davidson-Bourdin Index (DBI): ; Where Sc is the cohesion of cluster c; Mc,c' is the center distance between clusters c and c'; The DBI value ranges from [0, +∞], and the smaller the value, the better the clustering effect. ③ Kalinsky-Harabas Index (CHI): ; Where SSB is the inter-cluster sum of squares; SSW is the sum of squares within a cluster; The CHI value ranges from [0, +∞], and the larger the value, the better the clustering effect. ④S_Dbw efficiency index (S_Dbw): ; Where scat is the intra-cluster variance; Dens_bw represents the density difference between clusters; The value of S_Dbw ranges from [0,+∞], and the smaller the value, the better the clustering effect. ⑤ Dunn Index (DI): ; Where δ(Ci,Cj) is the distance between the i-th cluster and the j-th cluster; Δ(Cl) is the maximum intra-cluster distance (diameter) of the l-th cluster; DI ranges from [0,+∞], and the larger the value, the better the clustering effect; ⑥ The ratio of separation degree to compactness (S / C): ; Where Sep represents the degree of separation between clusters; Comp represents the cluster compactness; The S / C value ranges from [0, +∞], and the larger the value, the better the clustering effect.
[0012] c. Visual output: If the feature dimension n≤3, the sample cluster distribution is displayed by scatter plot, with "×" marking noise points and "☆" marking cluster centers; If n > 3, then the dimension is reduced to two or three dimensions using principal component analysis (PCA) and then visualized. d. Final output: Cluster labels (cluster number of each sample), cluster center matrix, cluster quality indicators, and visualization charts.
[0013] The present invention provides a clustering method for intra-annual runoff distribution patterns based on threshold guidance and average connectivity. By employing the above method, the following beneficial effects can be achieved: (1) Construct samples based on runoff percentages to eliminate interference from differences in annual runoff magnitude, focus on the allocation pattern itself, and solve the clustering distortion problem caused by differences in magnitude in traditional methods; (2) The Mahalanobis distance is used to detect outliers. Combined with the judgment rule of "threshold × median", it is adapted to the extreme value characteristics of runoff data and effectively resists the interference of events such as catastrophic floods and prolonged droughts. (3) Adaptive threshold and cluster number determination: The threshold D0 is automatically calculated based on the distance distribution characteristics, eliminating the need for manual preset of the cluster number, avoiding subjective errors, and adapting to the runoff data characteristics of different regions; (4) The average connectivity criterion and the number priority design when multiple clusters compete ensure the similarity of samples within a cluster and the stability of the clustering results, and adapt to the clustering requirements of percentage data. Attached Figure Description
[0014] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is an overall flowchart of the method described in this invention.
[0015] Figure 2 This diagram illustrates the two most distant samples and their allocation process when performing cluster analysis on the percentage of runoff at the outlet of a watershed using the method of this invention.
[0016] Figure 3 This is a schematic diagram showing the distribution of runoff percentages at the cluster with the largest number of samples after clustering using the method of this invention, and the cluster center.
[0017] Figure 4 This is a two-dimensional visualization scatter plot of the clustering results obtained using the method of this invention after dimensionality reduction by principal component analysis.
[0018] Figure 5 This is a visualization of the clustering results of the same dataset using the K-means clustering method.
[0019] Figure 6 This is a visualization of the clustering results of the same dataset using traditional hierarchical clustering methods.
[0020] Figure 7 This is a visualization of the clustering results of the same dataset using the DBSCAN clustering method.
[0021] Figure 8 This is a visualization of the clustering results of the same dataset using the spectral clustering method. Detailed Implementation
[0022] The present invention will be further described below with reference to specific embodiments. The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the present invention. In order to better illustrate the specific embodiments of the present invention, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the actual product size.
[0023] 1. Data Preparation Daily runoff observation data (without missing values) from 1957 to 2023 for 67 years were selected from the outlet of a certain watershed. The data were divided into ten-day periods (n=36) to calculate the runoff percentage for each of the 36 ten-day periods. A 67×36 sample matrix X was constructed, and some of the data are shown in Table 1.
[0024] Table 1. Partial data on the percentage of runoff at the outlet of the watershed from 1957 to 2023 (unit: %)
[0025] 2. Implementation Steps Breakdown (1) Outlier handling a. Calculate the mean vector μ = [0.89, 0.74, 0.78, ..., 0.80] and the covariance matrix ∑ of the sample matrix X; b. Solving for the ∑pseudoinverse ∑ 1 Calculate the Mahalanobis distance (d) for each sample. M ), d M The calculated value ranges from 3.46 to 7.20, d M The median is 6.02; c. Using the default threshold T=2, no abnormal samples were detected, so the sample matrix X was used directly for the next calculation.
[0026] (2) Distance matrix calculation a. Select Euclidean distance (default method). If the number of samples exceeds 50, enable parallel computing (67 samples, 8 cores for parallel computing). b. Calculate the 67×67 distance matrix D. ist The maximum distance D max =21.86, minimum non-zero distance D min =3.76.
[0027] (3) Determination of distance threshold (D0) Extracting the set of non-repeating distances D, and calculating it using the median method (default method), we get D0 = 10.17, which satisfies D. min <D0<D max .
[0028] (4) Clustering process (in conjunction with appendix) Figure 2 (As shown) a. Initialize the cluster: The two samples with the largest distance are from 1971 and 1987 ( Figure 2 ), respectively designated as C1 and C2; b. Sample allocation: Taking 1975 as an example ( Figure 2 The average distance from C1 to C1 is calculated to be 15.94 (>10.17), and the average distance to C2 is 8.85 (<10.17). This is then added to C2. c. Finally, 7 clusters and 2 noise points (1986 and 1996) were obtained. Cluster 1 contained 2 samples, cluster 2 contained 8 samples, cluster 3 contained 12 samples, cluster 4 contained 19 samples, cluster 5 contained 2 samples, cluster 6 contained 17 samples, and cluster 7 contained 5 samples.
[0029] Taking cluster 6, which has the largest number of samples, as an example, we show its samples and cluster center, such as... Figure 3 As shown.
[0030] (5) Output of results a. Output cluster centers; some dimensional data are shown in Table 2.
[0031] Table 2. Cluster centers of ten-day runoff percentage samples at the watershed exit (unit: %)
[0032] b. Output clustering quality metrics: SC=0.22, DBI=2.19, CHI=6.43, S_Dbw=0.80, DI=0.28, S / C=1.27.
[0033] c. Visualization: The sample feature dimension is 36, which needs to be reduced using principal component analysis. A two-dimensional scatter plot is then drawn based on the reduced principal components. Noise points are marked with a black "×", cluster centers are marked with "☆" filled with different shades of gray, and samples from different clusters are marked with "○" filled with different shades of gray. Figure 4 As shown.
[0034] 3. Effect Verification (1) Clustering results analysis of the present invention Figure 2 The results show that the samples from 1971 (belonging to C1) and 1987 (belonging to C2) are the farthest apart (Euclidean distance), and their annual runoff distribution patterns differ significantly. Specifically, the former's runoff is concentrated in late June, while the latter's runoff is concentrated in early to mid-September. These two samples are the least likely to belong to the same cluster among all samples. Therefore, choosing the two samples with the greatest Euclidean distance as the starting point for clustering is reasonable.
[0035] Depend on Figure 3It can be seen that cluster 6 (the cluster with the largest number of samples) contains 17 samples, accounting for 25.3% of the total given samples. The peak of its cluster center curve is located in the 19th ten-day period (early July), and remains high from the 20th to the 27th ten-day periods (mid-July to late September). This indicates that the annual runoff distribution pattern corresponding to cluster 6 is a pattern that frequently occurs in the upper reaches of the basin, and that the runoff is mainly concentrated in the flood season from July to September, with the runoff in early July accounting for the largest proportion of the annual runoff.
[0036] Located deep inland, the basin's water source primarily relies on meltwater from high-altitude glaciers and seasonal snowfall in the Qilian Mountains. Influenced by the edge effect of the East Asian summer monsoon, precipitation is highly concentrated in the summer. Entering July, temperatures reach their highest point of the year, and glacial and snowmelt volumes peak. This coincides with the strongest summer monsoon and the period of most concentrated rainfall. The intense meltwater driven by high temperatures and abundant precipitation occur simultaneously. Furthermore, the steep terrain of the Qilian Mountains facilitates rapid runoff, and these combined factors create a significant peak in runoff in early July. Therefore, the basin's runoff during the flood season (July to September), which dominates the annual volume and peaks in early July, is a result of the combined effects of its unique geographical location and climatic environment.
[0037] (2) Comparison between the present invention and traditional clustering methods This invention is compared with four traditional clustering methods (K-means clustering, traditional hierarchical clustering, DBSCAN clustering, and spectral clustering). In the clustering analysis of the percentage of runoff at the outlet of the watershed, the maximum number of clusters for K-means clustering, traditional hierarchical clustering, and spectral clustering was set to 8. Multiple trials were conducted using SC as the control index, and the optimal number of clusters for K-means clustering, traditional hierarchical clustering, and spectral clustering were determined to be 6, 3, and 2, respectively. For DBSCAN clustering, the elbow method was used to determine the neighborhood radius as 10.94, and the empirical formula (minPts = [n / 15] + 1, where minPts is the minimum number of samples in the neighborhood of the core point, and n is the feature dimension) was used to determine minPts as 5. The clustering results of K-means clustering, traditional hierarchical clustering, DBSCAN clustering, and spectral clustering are shown in the figures below. Figures 5-8 The clustering quality indices of this invention and these four traditional clustering methods are shown in Table 3.
[0038] This invention has significant advantages in its core features. As shown in Table 3, this invention boasts the highest level of automation, eliminating the need for manual pre-setting of key parameters such as cluster size and distance thresholds. The entire clustering process is adaptively completed based on the inherent characteristics of the runoff data, avoiding subjective errors and significantly reducing the operational threshold. Furthermore, this invention (… Figure 4 K-means has outstanding anti-interference ability and can accurately identify and remove abnormal samples and noise points caused by extreme hydrological events. Figure 5 Traditional hierarchical clustering ( Figure 6), spectral clustering ( Figure 8 None of them have the ability to identify abnormal samples, DBSCAN ( Figure 7 It can only identify noise points and cannot cope with the damage to the clustering structure caused by abnormal samples, which makes the present invention more robust in complex hydrological data scenarios.
[0039] In terms of overall clustering quality, this invention still demonstrates significant advantages. Among the key clustering quality indicators, the silhouette coefficient (SC=0.22), Dunn index (DI=0.28), and separation-to-compactness ratio (S / C=1.27) are all superior to most traditional methods. The Davidson-Bourdin index (DBI=2.19) and S_Dbw validity index (0.80) are significantly lower than traditional hierarchical clustering and spectral clustering, only on par with K-means, exhibiting superior intra-cluster compactness and inter-cluster separation. Even though the Kalinsky-Harabas index (CHI=6.43) is lower than K-means and spectral clustering, its overall index balance far surpasses other methods, and it effectively avoids the clustering failure problem caused by poor adaptability of DBSCAN. Figure 8 It perfectly adapts to the characteristics of runoff percentage data, and the clustering results are more in line with the actual annual runoff distribution pattern.
[0040] Table 3 Comparison between the present invention and traditional clustering methods
[0041] (3) Conclusion a. This invention does not require manual preset of any key parameters. It adaptively determines the number of clusters and thresholds based on runoff data characteristics throughout the entire process. Its degree of automation is significantly better than traditional methods. It avoids the cluster number preset of K-means and spectral clustering, the distance threshold setting of traditional hierarchical clustering, and the dual parameter dependence of DBSCAN. It completely eliminates subjective bias and reduces the operation threshold. b. This invention provides superior clustering quality and stability. Among the core indicators, SC, DI, and S / C outperform most traditional methods, while DBI and S_Dbw are significantly lower than traditional hierarchical clustering and spectral clustering. Although CHI is inferior to K-means and spectral clustering, it exhibits outstanding indicator balance and avoids the adaptability failure problem of DBSCAN, thus better suiting the characteristics of runoff percentage data. c. The cluster centers obtained by this invention clearly depict the core characteristics of different types of runoff distribution patterns within the year. The percentage distribution of runoff in each time period is highly consistent with the geographical environment of the basin's temperate continental climate and topographic differentiation, intuitively reflecting the temporal distribution pattern of regional water resources, and fully verifying the scientific nature and effectiveness of the method.
Claims
1. A clustering method for intra-annual runoff distribution patterns based on threshold-guided and average connectivity, characterized in that... Includes the following steps: S1. Runoff data preprocessing: Collect multi-year, time-period runoff observation data of river control sections in the target watershed, divide the data into annual units, calculate the percentage of runoff in each month or ten-day period of each year to the total annual runoff, and construct an m×n dimensional sample matrix X, where m is the number of years and n is the number of time units. S2. Outlier Detection and Handling: According to the preset outlier handling strategy, outlier samples in the sample matrix X are identified and removed to obtain a clean sample matrix. S3, Distance matrix calculation: Based on the selected distance metric, calculate the pairwise distances between all samples in the clean sample matrix, generating an m'×m' dimensional distance matrix D. ist ; S4. Distance threshold D0 is automatically determined: Extracting the distance matrix D ist The distance between all non-repeating samples is calculated using a preset threshold selection method to obtain a distance threshold D0, and D0 satisfies D min <D0<D max D min Dmax is the minimum distance between all non-zero samples, and Dmax is the maximum distance between samples. S5, Threshold-guided average connectivity clustering: Using distance matrix D ist Using the threshold D0 as input, the cluster assignment of samples is achieved through the average connectivity criterion; S6. Clustering results output: After completing the cluster assignment of all samples, a cluster label is generated for each sample. Abnormal samples and small clusters are treated as noise points. The mean vector of each cluster is calculated as the cluster center. The cluster label, cluster center and cluster quality evaluation index are output to obtain the clustering results of the annual runoff distribution pattern.
2. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: In S1, the runoff observation data for each time period is daily runoff data. The monthly or ten-day runoff is obtained by accumulating the daily runoff data, and then the percentage of the monthly or ten-day runoff to the total annual runoff is calculated.
3. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity as described in claim 1, characterized in that: In S2, the outlier handling strategy is the Mahalanobis distance outlier detection method, specifically: Calculate the Mahalanobis distance for each sample. Samples with a Mahalanobis distance greater than "outlier detection threshold × median Mahalanobis distance of all samples" are identified as outliers and removed. The outlier detection threshold ranges from 2 to 4.
4. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: In S3, the distance metric is selected from one of Euclidean distance, cosine distance, or Manhattan distance.
5. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: In S3, the distance matrix calculation supports parallel computing mode. When parallel computing is enabled, a parallel loop is created to calculate the upper triangular part of the distance matrix, and then the symmetry of the distance matrix is used to fill the lower triangular part to obtain the complete distance matrix D. ist .
6. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: In S4, the threshold selection method is selected from one of the mean method, median method, percentile method or inflection point method, or the percentile method is selected by default.
7. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: In step S5, average connectivity clustering includes the following steps: S5.1 Initialize the cluster: Select the two samples with the largest distance in the distance matrix Dist as the seed points of the initial cluster, and construct two initial clusters; S5.2 Sample Iteration Allocation: Iterate through all remaining samples and calculate the average distance from each sample to each existing cluster. If there is no cluster with an average distance less than D0, then create a new cluster for that sample. If there is a cluster with an average distance less than D0, then the sample is assigned to the cluster with the smallest average distance. If the average distance between multiple clusters is equal, then the cluster containing the sample with the smallest number within that cluster is selected.
8. The method for clustering intra-annual runoff distribution patterns based on threshold-guided and average connectivity according to claim 7, characterized in that: In S5.2, the formula for calculating the average distance from a sample to a cluster is as follows: In the formula, xp is the sample to be assigned; Cc is the c-th cluster; |Cc| represents the number of samples in cluster Cc; d(x p ,x) represents the distance between the sample to be assigned and the samples within the cluster.
9. The method for clustering intra-annual runoff distribution patterns based on threshold-guided and average connectivity according to claim 1, characterized in that: In S6, the clustering quality assessment indicators include: silhouette coefficient, Davidson-Baudin index, Kalinsky-Harabass index, S_Dbw validity index, Dunn index, and the ratio of separation to compactness. Among them, the larger the silhouette coefficient, the smaller the Davidson-Baudin index, the larger the Kalinsky-Harabass index, the smaller the S_Dbw validity index, the larger the Dunn index, and the larger the ratio of separation to compactness, the better the clustering effect.
10. The intra-annual runoff distribution pattern clustering method based on threshold-guided and average connectivity according to claim 1, characterized in that: When the feature dimension n≤3 of the sample matrix, the clustering result visualization step is also included: The cluster distribution of sample points is shown by scatter plot, and noise points and cluster centers of each cluster are marked with special labels.