A watershed water environment intelligent early warning and tracing method and device

CN122948282APending Publication Date: 2026-10-20SICHUAN TUOPU ENVIRONMENTAL PROTECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611354060.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-02
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0005]本申请提供了一种流域水环境的智能预警与溯源方法及装置,该方法解决了水动力学物理扩散过程与水体光谱化学特征相互割裂导致的单维度推演误差累积问题,提升污染溯源的准确性

Benefits of technology

1、对采集的多源异构数据进行整合和提取,得到统一特征向量,实现从宏观到微观、从物理到化学的全方位监测覆盖,再将统一特征向量分别输入预设水质机理模型、预设机器学习模型和预设深度学习模型,得到多个水质指标预测值,并基于历史回溯窗口内各模型的预测误差动态计算目标权重进行加权求和,有效克服了单一模型在复杂水文条件下预测精度不稳定的问题,使得综合水质指标预测值的准确性得到提升;通过利用水动力学对超标断面的水文序列进行时间反演计算各候选污染源的水动力置信度,同时将水体实测光谱特征与各候选污染源的光谱特征进行匹配计算得到光谱置信度,再对两者进行加权融合得到综合置信度,实现了物理传播过程与化学特征指纹的相互验证和交叉校核,即使单一通道因参数不确定性产生偏差,另一通道仍可提供独立证据支持,提升污染溯源的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure QLYQS_1
    Figure QLYQS_1
Patent Text Reader

Abstract

A method and device for intelligent early warning and source tracing of watershed water environment, relating to the field of water environment source tracing technology, is disclosed. The method involves receiving and extracting multi-source heterogeneous data from a target watershed to obtain a unified feature vector; inputting this unified feature vector into multiple models for processing, and calculating the predicted water quality indicators output by each model along with the target weights to obtain a comprehensive predicted water quality indicator; generating early warning information based on the comprehensive predicted water quality indicator; responding to the early warning information, extracting the hydrological sequence and measured spectral features of the exceeding sections, performing time-reversal calculations on the hydrological sequence to obtain hydrodynamic confidence; calculating the spectral confidence of the measured spectral features of the water body to obtain spectral confidence; determining the comprehensive confidence of each candidate pollution source based on the hydrodynamic and spectral confidence; identifying the target pollution source based on the comprehensive confidence and automatically locating the corresponding target pollution outlet, and outputting the source tracing results based on the target pollution outlet. Implementing this method improves the accuracy of pollution source tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water environment source tracing technology, specifically to an intelligent early warning and source tracing method and device for watershed water environment. Background Technology

[0002] Watershed water environment management is an important component of ecological civilization construction. With the rapid advancement of industrialization and urbanization, watershed water pollution exhibits complex characteristics such as multi-source, sudden onset, and cross-regional diffusion. To achieve continuous improvement in watershed water quality, precise intelligent early warning of the water environment and rapid and accurate source tracing after pollution occurs have become research hotspots in the fields of smart environmental protection and watershed water management.

[0003] Currently, mainstream watershed water environment monitoring technologies mainly rely on automatic online water quality monitoring stations deployed at key sections of the watershed to collect routine time-series water quality indicators in real time. In terms of early warning and source tracing, existing technologies mostly use a single water quality numerical simulation model to predict water quality evolution, combined with a fixed water quality exceedance threshold to trigger system alarms; when locating pollution sources, remote sensing spectral inversion technology is used to compare the similarity of water body spectral characteristics.

[0004] However, the existing source tracing methods described above separate the "hydrodynamic physical diffusion process" from the "spectrochemical characteristics of water bodies," performing only a single-dimensional extrapolation. If only hydrodynamic reverse tracing is relied upon, due to the variability of actual river flow velocity, the uncertainty of the longitudinal dispersion coefficient, and the dynamic deviation of the comprehensive attenuation coefficient, the reverse solution of the convection-diffusion equation is prone to cumulative errors. This results in a severe distortion between the inferred emission time and the theoretical emission concentration, making it impossible to effectively match with the historical emission records of the pollution source and affecting the accuracy of pollution source tracing. Summary of the Invention

[0005] This application provides an intelligent early warning and source tracing method and device for watershed water environment. This method solves the problem of single-dimensional extrapolation error accumulation caused by the separation between hydrodynamic physical diffusion process and water body spectrochemical characteristics, and improves the accuracy of pollution source tracing.

[0006] Firstly, this application provides an intelligent early warning and source tracing method for watershed water environment. The method includes: receiving multi-source heterogeneous data collected from a target watershed; aligning and extracting feature values ​​from the multi-source heterogeneous data to obtain a unified feature vector; inputting the unified feature vector into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model for processing to obtain multiple predicted water quality indicators, with each predicted water quality indicator corresponding to one model; obtaining the prediction error of each model within a historical backtracking window, and calculating the target weight of each model at the current time based on the prediction error; weighting and summing the predicted water quality indicators output by each model with the corresponding target weight to obtain a comprehensive water quality indicator prediction value, and then calculating the comprehensive water quality indicator prediction value based on the predicted water quality indicator prediction value. The system generates early warning information based on predicted values ​​of quality indicators. In response to the early warning information, it extracts the hydrological sequence of the exceeding section and determines the set of candidate pollution sources based on the coordinates of the sewage outlet. It then uses hydrodynamics to perform time inversion on the hydrological sequence and calculates the hydrodynamic confidence of each candidate pollution source. It acquires the measured spectral characteristics of the water body at the exceeding section and calculates the spectral confidence of each candidate pollution source by combining the measured spectral characteristics of the water body with the spectral characteristics of each candidate pollution source. It then performs weighted fusion of the hydrodynamic confidence and spectral confidence to obtain the comprehensive confidence of each candidate pollution source. The system identifies candidate pollution sources with a comprehensive confidence greater than a preset threshold as target pollution sources, automatically locates the target pollution outlet corresponding to the target candidate pollution source, and outputs the source tracing results based on the target pollution outlet.

[0007] By adopting the above technical solution, the collected multi-source heterogeneous data are integrated and extracted to obtain a unified feature vector, achieving comprehensive monitoring coverage from macro to micro and from physical to chemical. The unified feature vector is then input into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model to obtain multiple water quality index prediction values. Based on the prediction errors of each model within the historical backtracking window, the target weights are dynamically calculated and weighted summed, effectively overcoming the problem of unstable prediction accuracy of a single model under complex hydrological conditions, thus improving the accuracy of comprehensive water quality index prediction values. By using hydrodynamics to perform time-reversal calculation of the hydrological sequence of the exceeding section to calculate the hydrodynamic confidence of each candidate pollution source, and matching the measured spectral characteristics of the water body with the spectral characteristics of each candidate pollution source to calculate the spectral confidence, the two are then weighted and fused to obtain the comprehensive confidence, realizing mutual verification and cross-checking of physical propagation processes and chemical fingerprints. Even if a single channel deviates due to parameter uncertainty, the other channel can still provide independent evidence support, improving the accuracy of pollution source tracing.

[0008] Optionally, the prediction errors of each model within the historical backtracking window are obtained, and the target weights of each model at the current moment are calculated based on the prediction errors. Specifically, this includes: obtaining the predicted values ​​of each model at historical moments and the corresponding measured water quality index values ​​at historical moments from the historical backtracking window; calculating the prediction errors of each model using the first formula; calculating the reciprocal of each prediction error and normalizing it using the second formula to obtain the initial weights of each model at the current moment; obtaining rainfall data, river hydrological data, and upstream reservoir data from multi-source heterogeneous data; determining the hydrological period of the target watershed at the current moment based on the rainfall data, river hydrological data, and upstream reservoir data; matching the corresponding hydrological correction factor based on the hydrological period; correcting the correction factor and the initial weights of each model using the third formula, and normalizing the corrected weights to obtain the target weights of each model at the current moment.

[0009] By adopting the above technical solution, the predicted values ​​of each model at historical moments and the corresponding measured water quality index values ​​are obtained from the historical backtracking window. The prediction error of each model is calculated using the first formula, which can objectively evaluate the actual performance of different models in historical periods. The reciprocal calculation of each prediction error and the normalization process using the second formula are used to obtain the initial weights, ensuring that the model with higher prediction accuracy receives a larger weight coefficient. This allows the superior model to play a more significant role in the weighted summation. Rainfall data, river hydrological data, and upstream reservoir data are extracted from multi-source heterogeneous data. Based on these hydrological elements, the hydrological period of the target watershed at the current moment is determined and the corresponding hydrological correction factor is matched. The initial weights are then corrected and normalized using the third formula to obtain the target weights. This ensures that the weight allocation not only reflects the historical performance of the model but also adapts to the differences in water quality evolution patterns under different hydrological conditions. This overcomes the limitations of traditional fixed-weight integration methods in dealing with dynamic hydrological environments and ensures that each model can achieve optimal performance in different hydrological scenarios.

[0010] Optionally, the first formula is as follows: ; Among them, E i Y(t) represents the prediction error of the model at time t, and Y0(tj) represents the measured water quality index value at the historical time tj; i (tj) represents the model's predicted value at historical time tj; N represents the length of the historical backtracking window; i represents the model index, and i∈{preset water quality mechanism model, preset machine learning model, preset deep learning model}; j represents the offset index of the historical time; the second formula is as follows: ; Among them, w i (t) represents the initial weights of the model at time t, and satisfies α represents the preset sensitivity coefficient, M represents the total number of models participating in the integration, k represents the loop index variable for model summation, and E k (t) represents the prediction error of model k at time t; The third formula is as follows: Among them, W i (t) represents the target weight of the model at time t, βi represents the hydrological correction factor for model i corresponding to the current hydrological period, k represents the circular index variable for model summation, and w k (t) represents the initial weights of the model at time t, β k The model k represents the hydrological correction factor corresponding to the current hydrological period, and M represents the total number of models participating in the integration.

[0011] By adopting the above technical solutions, the first formula objectively quantifies the prediction performance of each model in the recent period by calculating the relative error between the predicted value and the measured water quality index value of each model at a historical time within the historical backtracking window and taking the average value. The second formula uses an exponential function to convert the prediction error inversely and normalize it to obtain the initial weight. This design allows models with smaller prediction errors to obtain higher weight coefficients. Furthermore, by introducing a preset sensitivity coefficient to adjust the degree of influence of error on weight allocation, the system vulnerability caused by a single model dominance is effectively avoided. The third formula further introduces the hydrological correction factor into the weight calculation. By normalizing the product of the initial weight and the hydrological correction factor, the target weight is obtained. This allows the weight allocation not only to be based on the historical performance of the model, but also to be dynamically adjusted according to the hydrological period of the target watershed at the current time. It fully considers the applicability differences of the preset water quality mechanism model, preset machine learning model, and preset deep learning model under different hydrological conditions.

[0012] Optionally, early warning information is generated based on the predicted values ​​of comprehensive water quality indicators. Specifically, this includes: dividing the predicted value of each water quality indicator in the comprehensive water quality indicator prediction value by the corresponding preset standard limit to obtain the standardized index of each water quality indicator; using preset indicator weights to perform a weighted summation of each standardized index to calculate the comprehensive early warning index; comparing the comprehensive early warning index with a first early warning threshold, a second early warning threshold, and a third early warning threshold, wherein the first early warning threshold is greater than the second early warning threshold, and the second early warning threshold is greater than the third early warning threshold; if the comprehensive early warning index is greater than or equal to the first early warning threshold, a severe early warning information is generated; if the comprehensive early warning index is less than the first early warning threshold but greater than or equal to the second early warning threshold, a moderate early warning information is generated; if the comprehensive early warning index is less than the second early warning threshold but greater than or equal to the third early warning threshold, a mild early warning information is generated.

[0013] By adopting the above technical solution, the predicted values ​​of each water quality indicator in the comprehensive water quality index prediction value are divided by the corresponding preset standard limit to obtain a standardized index. This eliminates the incomparability caused by differences in the dimensions and numerical ranges of different water quality indicators. The comprehensive early warning index is obtained by weighted summation of each standardized index using preset indicator weights. This fully considers the differences in the degree of impact of different water quality indicators on the watershed's ecological environment. By comparing the comprehensive early warning index with the first, second, and third early warning thresholds, severe, moderate, or mild early warning information is generated according to different intervals of the comprehensive early warning index. This tiered early warning can accurately reflect the severity of water environment risks, enabling the activation of emergency response and joint law enforcement when a severe early warning is triggered, the strengthening of monitoring frequency and investigation efforts when a moderate early warning is triggered, and preventive reminders and continuous tracking when a mild early warning is triggered. This achieves the rational allocation and precise deployment of regulatory resources.

[0014] Optionally, in response to the early warning information, the hydrological sequence of the exceeding section is extracted, and a set of candidate pollution sources is determined based on the coordinates of the sewage outlet. Hydrodynamics is used to perform time inversion on the hydrological sequence to calculate the hydrodynamic confidence level of each candidate pollution source. Specifically, this includes: determining the exceeding section from the target watershed based on the early warning information, and obtaining the spatial location and trigger time of the exceeding section; extracting the hydrological sequence of the exceeding section within a preset historical period before the trigger time of the exceeding section, the hydrological sequence including at least the measured water level, river cross-sectional geometric parameters, and river slope; using the Manning formula to calculate the measured water level, river cross-sectional geometric parameters, and river slope to obtain the cross-sectional average flow velocity of the exceeding section; and using the Fisher longitudinal discretization formula to analyze the cross-sectional average flow velocity, river width, average water depth, and shear flow in the river cross-sectional geometric parameters. The longitudinal dispersion coefficient of the river channel where the exceeding section is located is calculated quickly. Based on the coordinates of the discharge outlets of each candidate pollution source, the spatial distance between each candidate pollution source and the exceeding section is calculated. The spatial distance is divided by the average flow velocity of the section to obtain the theoretical propagation time corresponding to each candidate pollution source. The theoretical emission time corresponding to each candidate pollution source is inversely calculated by subtracting the exceeding trigger time from the theoretical propagation time. Based on the theoretical propagation time, longitudinal dispersion coefficient, and comprehensive attenuation coefficient, the exceeding concentration of the exceeding section is calculated by time inversion to obtain the theoretical emission concentration of each candidate pollution source at the theoretical emission time. The historical actual emission records of each candidate pollution source before and after the theoretical emission time are obtained. The matching degree between the theoretical emission concentration and the historical actual emission records is calculated to obtain the hydrodynamic confidence of each candidate pollution source.

[0015] By adopting the above technical solution, the exceeding cross-sections can be identified based on the early warning information, and their spatial locations and trigger times can be obtained. This clarifies the starting point and time benchmark for pollution source tracing. The hydrological sequence of the exceeding cross-section within a preset historical period before the trigger time, including measured water level, river cross-sectional geometric parameters, and river slope, can be extracted. The Manning formula is used to calculate the average flow velocity of the cross-section based on the measured water level, river cross-sectional geometric parameters, and river slope. Then, Fisher's longitudinal discretization formula is used to calculate the longitudinal discretization coefficient for the average flow velocity, river width, average water depth, and shear velocity. The spatial distance between the candidate pollution source's discharge outlet coordinates and the exceeding cross-section is calculated, and... The theoretical propagation time is obtained by dividing the spatial distance by the average flow velocity of the cross section. Then, the theoretical emission time is obtained by subtracting the trigger time of exceeding the standard from the theoretical propagation time, thus realizing the time dimension tracing of the pollutant transport process. Furthermore, the theoretical emission concentration is obtained by time inversion calculation of the excess concentration of the exceeding section based on the theoretical propagation time, longitudinal dispersion coefficient, and comprehensive attenuation coefficient, thus completing the concentration dimension inversion of the pollutant diffusion and dilution process. By obtaining the historical actual emission records of each candidate pollution source before and after the theoretical emission time, the hydrodynamic confidence degree is obtained by matching the theoretical emission concentration with the historical actual emission records, thus realizing the cross-validation of theoretical calculation and actual emission data.

[0016] Optionally, the measured spectral characteristics of the water body at the exceeding section are obtained, and the measured spectral characteristics of the water body and the spectral characteristics of each candidate pollution source are calculated to obtain the spectral confidence of each candidate pollution source. Specifically, this includes: obtaining hyperspectral remote sensing data of the water body at the exceeding section at the trigger time of exceeding the standard, extracting the remote sensing reflectance of multiple characteristic bands within a preset band range, and constructing the measured spectral fingerprint vector of the exceeding section; obtaining the historical spectral fingerprint vector corresponding to each candidate pollution source from the preset spectral fingerprint database, wherein the historical spectral fingerprint vector is composed of the historical remote sensing reflectance of the corresponding candidate pollution source under the same characteristic band; calculating the vector dot product between the measured spectral fingerprint vector and the historical spectral fingerprint vector of each candidate pollution source, multiplying the magnitude of the measured spectral fingerprint vector and the magnitude of each historical spectral fingerprint vector to obtain the vector magnitude; dividing the vector dot product by the vector magnitude to obtain the spectral similarity of each candidate pollution source; calculating the spectral angular distance of each candidate pollution source by the inverse cosine function of each spectral similarity; and determining the spectral confidence of each candidate pollution source based on the spectral similarity and spectral angular distance of each candidate pollution source.

[0017] By adopting the above technical solution, hyperspectral remote sensing data of the water body at the moment of triggering the exceedance of the standard section are obtained, and remote sensing reflectance of multiple characteristic bands within a preset band range is extracted to construct a measured spectral fingerprint vector. This can capture the spectral feature information of the water body exceeding the standard. Historical spectral fingerprint vectors corresponding to each candidate pollution source are obtained from the preset spectral fingerprint database, ensuring that the reference benchmark for source tracing and comparison comes from the historical remote sensing reflectance under the same characteristic band, thus guaranteeing the comparability and consistency of spectral features. The dot product between the measured spectral fingerprint vector and each historical spectral fingerprint vector is calculated, and the magnitudes of the two are multiplied to obtain the vector magnitude. The dot product is then divided by the vector magnitude to obtain the spectral similarity. The spectral angular distance is obtained by calculating the spectral similarity using an inverse cosine function, providing a geometric measure of the difference in spectral shape. The spectral confidence level corresponding to each candidate pollution source is determined based on the spectral similarity and spectral angular distance, realizing a quantitative assessment of the degree of matching of the chemical features of the pollution source. This effectively overcomes the problem of misjudgment caused by spectral interference factors that may occur when relying solely on spectral similarity in the existing technology.

[0018] Optionally, the spectral confidence level of each candidate pollution source is determined based on the spectral similarity and spectral angular distance of each candidate pollution source. Specifically, this includes: determining whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold and whether the corresponding spectral angular distance is less than a preset angular distance threshold; the target candidate pollution source can be any one of the candidate pollution sources. If the spectral similarity of the target candidate pollution source is greater than the first similarity threshold and the spectral angular distance of the target candidate pollution source is less than the preset angular distance threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a first matching state with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined to be a value within the first confidence level interval. If the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, the spectral confidence level of the target candidate pollution source is determined to be... The similarity is determined by whether it is greater than a second similarity threshold; wherein, the first similarity threshold is greater than the second similarity threshold; if the spectral similarity of the target candidate pollution source is greater than the second similarity threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a second matching state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the second confidence interval; if the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a mismatch state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the third confidence interval; wherein, the values ​​within the first confidence interval are all greater than the values ​​within the second confidence interval, and the values ​​within the second confidence interval are all greater than the values ​​within the third confidence interval.

[0019] By employing the above technical solution, it is determined whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold and whether the corresponding spectral angular distance is less than a preset angular distance threshold. When both conditions are met simultaneously, the measured spectral fingerprint of the exceeding section is determined to be in a first matching state with the target candidate pollution source, and the spectral confidence level is determined to be a value within the first confidence level interval. This ensures that only candidate pollution sources with highly consistent spectral vector directions and minimal spectral shape differences can be judged as highly matched, effectively avoiding misjudgment problems that may be caused by a single indicator. When the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, it is further determined whether the spectral similarity is greater than a second similarity threshold. If this condition is met, the measured spectral fingerprint is determined to be in a second matching state with the target candidate pollution source, and the spectral confidence level is determined to be within the second confidence level interval. The numerical value of this intermediate matching state setting can capture candidate pollution sources that have certain similarity in spectral features but have not yet reached the high matching standard, providing supplementary judgment basis for subsequent fusion verification with hydrodynamic confidence, and avoiding the omission of potential pollution sources that may be caused by simple dichotomy judgment; when the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, it is determined that the measured spectral fingerprint and the target candidate pollution source are in a mismatch state, and the spectral confidence is determined to be a value within the third confidence interval, thereby excluding candidate pollution sources with significant differences in spectral features; through the numerical gradient setting of the first confidence interval, the second confidence interval and the third confidence interval, the continuous hierarchical evaluation of spectral confidence is realized. This hierarchical confidence can more finely characterize the degree of spectral matching between different candidate pollution sources and the exceeding section.

[0020] The second aspect of this application provides an intelligent early warning and source tracing device for watershed water environment. The device includes a receiving unit, a processing unit, an early warning unit, and a source tracing unit. The receiving unit receives multi-source heterogeneous data collected from a target watershed. The processing unit aligns and extracts feature values ​​from the multi-source heterogeneous data to obtain a unified feature vector. The unified feature vector is then input into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model for processing to obtain multiple predicted values ​​of water quality indicators, with each predicted value corresponding to a model. The prediction error of each model within a historical backtracking window is obtained, and the target weight of each model at the current moment is calculated based on the prediction error. The early warning unit performs a weighted summation of the predicted water quality indicators output by each model with the corresponding target weight to obtain... The system integrates predicted water quality indicators and generates early warning information based on these predictions. The source tracing unit, responding to the early warning information, extracts the hydrological sequence of the exceeding sections and determines a set of candidate pollution sources based on the coordinates of the discharge outlets. It then uses hydrodynamics to perform time-reversal on the hydrological sequence and calculates the hydrodynamic confidence score for each candidate pollution source. The system acquires the measured spectral characteristics of the water body at the exceeding sections and calculates the spectral confidence score for each candidate pollution source by combining these characteristics with the spectral characteristics of each candidate pollution source. Finally, it performs a weighted fusion of the hydrodynamic and spectral confidence scores to obtain the comprehensive confidence score for each candidate pollution source. Candidate pollution sources with a comprehensive confidence score greater than a preset threshold are identified as target pollution sources. The system automatically locates the target pollution outlet corresponding to each target candidate pollution source and outputs the source tracing results based on the target pollution outlet.

[0021] In a third aspect, this application provides an electronic device including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory, causing the electronic device to perform any of the methods described above in this application.

[0022] In a fourth aspect, this application provides a computer-readable storage medium storing instructions that, when executed, perform any of the methods described above in this application.

[0023] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. The collected multi-source heterogeneous data is integrated and extracted to obtain a unified feature vector, achieving comprehensive monitoring coverage from macro to micro and from physical to chemical. The unified feature vector is then input into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model to obtain multiple water quality index prediction values. Based on the prediction errors of each model within the historical backtracking window, the target weights are dynamically calculated and weighted summed, effectively overcoming the problem of unstable prediction accuracy of a single model under complex hydrological conditions, thus improving the accuracy of comprehensive water quality index prediction values. By using hydrodynamics to perform time-reversal calculation of the hydrological sequence of the exceeding section, the hydrodynamic confidence of each candidate pollution source is calculated. At the same time, the measured spectral characteristics of the water body are matched with the spectral characteristics of each candidate pollution source to obtain the spectral confidence. The two are then weighted and fused to obtain the comprehensive confidence, realizing mutual verification and cross-checking of physical propagation processes and chemical fingerprints. Even if a single channel deviates due to parameter uncertainty, the other channel can still provide independent evidence support, improving the accuracy of pollution source tracing. Attached Figure Description

[0024] Figure 1 This is a flowchart illustrating an intelligent early warning and source tracing method for watershed water environment provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

[0025] Explanation of reference numerals in the attached figures: 200, electronic device; 201, processor; 202, memory; 203, user interface; 204, network interface; 205, communication bus. Detailed Implementation

[0026] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0027] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0028] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0029] Therefore, how to overcome the cumulative error in one-dimensional extrapolation caused by the disconnect between hydrodynamic physical diffusion processes and the spectrochemical characteristics of water bodies is a pressing issue. This application provides an intelligent early warning and source tracing method for watershed water environment, applied in a server. The server in this application can be a platform providing water quality monitoring, early warning, and source tracing services for watershed water environment. Figure 1 This is a flowchart illustrating an intelligent early warning and source tracing method for watershed water environment provided in an embodiment of this application. (Refer to...) Figure 1 The method includes the following steps S101-S108.

[0030] S101: Receives multi-source heterogeneous data collected from the target watershed.

[0031] In S101 above, the target watershed refers to a large watershed for which water environment monitoring is to be conducted, such as a tributary of the Yangtze River Economic Belt or an urban river basin. Multi-source heterogeneous data includes, but is not limited to, water quality monitoring data, meteorological and hydrological data, hyperspectral remote sensing data, visible light imagery data, and video surveillance data. Water quality monitoring data originates from online water quality monitoring stations deployed at key sections of the watershed. Multiple water quality indicators, such as pH, chemical oxygen demand (COD), ammonia nitrogen (NH3-N), total phosphorus (TP), total nitrogen (TN), and dissolved oxygen (DO), are collected in real time using IoT sensors. This data is stored in JSON or CSV format, containing a unique station ID, a timestamp, and the measured values ​​of each indicator. The update frequency reaches the minute level, reflecting the dynamic trends of water quality changes in real time.

[0032] Meteorological and hydrological data are sourced from meteorological and hydrological stations within the watershed. Meteorological data includes elements such as temperature, humidity, wind speed, rainfall, and air pressure, stored in NetCDF or GRIB format, with hourly temporal resolution and 1-kilometer grid spatial resolution, updated hourly, providing predictive models with external environmental factors influencing water quality changes. Hydrological data includes hydrological elements such as river flow, water level, and flow velocity, stored in XML or CSV format, also with hourly temporal resolution and real-time updating capabilities. These data are key input parameters for pollutant diffusion simulation and source tracing analysis. Hyperspectral remote sensing data is acquired through hyperspectral imagers mounted on satellites or UAVs, stored in the ENVI standard format including header files (.hdr) and data files (.dat), containing remote sensing reflectance information for over 100 spectral bands, with a spatial resolution of up to 10 meters and daily updates. This data can invert the spatial distribution characteristics of water quality parameters such as chlorophyll a concentration, suspended solids concentration, and dissolved organic carbon, and provide multidimensional spectral feature vectors for pollution source spectral fingerprinting. Visible light imagery data originates from drone aerial photography systems, storing RGB three-channel visible light images in TIFF or JPEG format. It boasts meter-level high spatial resolution and is acquired on demand during flight, primarily used to identify visual features such as floating debris, abnormal water color, and shoreline changes. Video surveillance data comes from AI-powered intelligent video surveillance equipment deployed at key sewage outlets and sensitive sections. It is transmitted in real-time as H.264 encoded video streams, simultaneously generating structured event logs in JSON format. The video streams have second-level temporal resolution, enabling real-time capture of abnormal events such as sewage outlet overflows, abnormal water discoloration, and floating debris accumulation.

[0033] These multi-source heterogeneous data maintain their original format and data structure during the reception phase. By monitoring the data access gateway, data streams of different protocols are uniformly accessed, and each data record is subjected to quality verification and anomaly removal to ensure that abnormal data points caused by sensor failure, communication interruption or human interference are removed. At the same time, each data is marked with a reception timestamp and data source identifier to establish a data traceability chain.

[0034] S102: Align and extract feature values ​​from multi-source heterogeneous data to obtain a unified feature vector.

[0035] In S102 above, since multi-source heterogeneous data differ in spatiotemporal benchmarks, data formats, and feature representations, they cannot be directly used for subsequent prediction model training and early warning analysis. Therefore, by systematically aligning and extracting features to convert multi-source heterogeneous data into a unified numerical feature space, effective fusion and collaborative analysis between different data sources can be achieved.

[0036] First, a unified spatiotemporal benchmark alignment layer is established. For the time benchmark, UTC timestamps are used as a unified standard with millisecond-level accuracy. All data sources are uniformly converted to UTC timestamp format when they are entered into the database, regardless of the original time format. This ensures that data with different update frequencies can be accurately aligned in the time dimension. For example, minute-level water quality monitoring data, hourly meteorological and hydrological data, day-level hyperspectral remote sensing data, and second-level video surveillance data are uniformly mapped onto the same time axis. The time stamp standardization process eliminates the time sequence misalignment problem caused by asynchronous data acquisition time. For the spatial reference, the CGCS2000 National Geodetic Coordinate System is adopted as a unified spatial reference framework. A 10m*10m spatial index grid is established through the DEM raster of the watershed. The target watershed is divided into regular grids, and each grid is assigned a unique ID spatial identifier. All data with spatial attributes, including the coordinates of water quality monitoring stations, the location of sewage outlets, the coordinates of hyperspectral remote sensing pixels, and the geographic reference information of UAV aerial images, are mapped to the corresponding grid cells through coordinate transformation and spatial interpolation methods, thereby realizing the spatial alignment of data with different spatial resolutions under the unified grid system.

[0037] After completing the spatiotemporal benchmark alignment, feature numerical extraction is performed on different types of raw data, converting unstructured or semi-structured data into numerical features that can be directly used by the prediction model. For video surveillance data, keyframes are extracted from the H.264 encoded video stream at fixed time intervals, and computer vision algorithms are applied to perform feature recognition and numerical extraction on each frame. To extract the Water Surface Color Index (WACI), video frames are converted from the RGB color space to the HSV color space. Image segmentation algorithms are used to identify water surface areas and eliminate background interference such as shorelines and buildings. The mean values ​​of hue (H), saturation (S), and brightness (V) of the water surface area are extracted. The Euclidean distance between the current water surface color feature vector and the pre-established normal water color reference vector is calculated. This distance value is standardized to a Water Surface Color Index between 0 and 1. The larger the value, the more significant the deviation of the water color from the normal state, which may indicate abnormal conditions such as algal blooms, industrial wastewater discharge, or suspended sediment. To extract the Floating Object Density Index (FDI), a target detection model based on the YOLOv8 deep learning framework was deployed. This model, trained on a large number of floating object samples, can automatically identify various floating objects such as plastic bottles, foam, aquatic plants, and animal carcasses in video footage. It counts the number of floating objects detected per unit area and normalizes this count into the FDI. This index can intuitively reflect the degree of water pollution and potential upstream waste discharge issues. To extract the Overflow Flag (OF) from sewage outlets, a water level recognition algorithm was used to analyze the sewage outlet monitoring footage. Edge detection and morphological processing were used to identify the water level position at the sewage outlet, determining whether the current water level exceeds a preset overflow threshold. If an overflow is detected, a binary flag of 1 is output; otherwise, 0 is output. This feature is of significant value for early warning of sewage treatment plant overflows during the rainy season. In addition, based on the light transmission attenuation model, the approximate value of water turbidity NTUest is obtained by analyzing the brightness distribution of video images. This method utilizes the negative correlation between water turbidity and light transmission capacity, and establishes an empirical regression model to estimate the turbidity value by statistically analyzing the visibility of underwater objects and the image brightness gradient in video frames.

[0038] For hyperspectral remote sensing data, preprocessing operations such as radiometric correction, atmospheric correction, and geometric refinement are performed on hyperspectral images in the ENVI standard format to eliminate sensor errors, atmospheric scattering effects, and geometric distortions, obtaining true surface reflectance data. To extract the chlorophyll-a concentration inversion value (Chl-a), the band ratio method is employed. Two characteristic bands sensitive to chlorophyll absorption characteristics, 705 nm and 665 nm, are selected. The ratio of remote sensing reflectance Rrs in these two bands, Rrs(705nm) / Rrs(665nm), is calculated. This band ratio is then converted into chlorophyll-a concentration values ​​using a pre-established empirical formula. This method utilizes the strong absorption characteristics of chlorophyll in the red light band and its high reflectance characteristics in the near-infrared band, effectively inverting algal biomass in water bodies. To extract suspended solids (SS) concentration, a semi-analytical algorithm was employed. The ratio of remotely sensed reflectance at 620 nm to 490 nm was used, combined with a model of the inherent optical properties of the water body, to invert the SS concentration. This characteristic is indicative of sediment pollution, industrial dust emissions, and sediment resuspension. To extract the dissolved organic carbon (DOC) spectral index, the ratio of fluorescence peak intensity at 355 nm to 420 nm was calculated. This ratio characterizes the degree of humification and source characteristics of organic matter in the water body, helping to differentiate between agricultural non-point source pollution and industrial organic wastewater. More importantly, the system extracts spectral fingerprint vectors from hyperspectral remote sensing data. These vectors are the core basis for subsequent spectral fingerprint comparison for pollution source tracing. Specifically, within the visible to near-infrared band range of 400 to 900 nanometers, 32 characteristic bands sensitive to water quality characteristics are selected at certain intervals. The remote sensing reflectance values ​​of each band are extracted to form a 32-dimensional spectral fingerprint vector FP. This vector can comprehensively reflect the optical properties and chemical composition of the water body. Different types of pollution sources will form unique spectral fingerprint features in the water body due to the different spectral absorption and reflection characteristics of their emitted substances. By comparing the spectral fingerprints of the water body exceeding the standard with the historical spectral fingerprints of known pollution sources, the identification and tracing of pollution sources can be achieved.

[0039] After extracting the feature values ​​from various data sources, a multi-source data fusion middleware is used to aggregate all extracted features into a unified feature vector generation layer. This middleware includes: a monitoring data access gateway responsible for protocol conversion, quality verification, and anomaly removal of water quality monitoring data; a remote sensing data preprocessing layer responsible for radiometric correction, atmospheric correction, and geometric refinement of hyperspectral remote sensing data; a meteorological-hydrological coupling layer responsible for spatiotemporal interpolation, scale matching, and physical dimension unification of meteorological and hydrological data; and a video data parsing layer responsible for frame extraction, target detection, and feature encoding of video surveillance data. The outputs of each processing layer are ultimately aggregated to generate a 42-dimensional unified feature vector X=[x1, x2, ..., x...]. 42 ] ∈ R 4², this vector includes eight water quality indicators: pH, COD, NH3-N, TP, TN, DO, conductivity, and turbidity; five meteorological features: temperature, humidity, wind speed, rainfall, and air pressure; three hydrological features: flow rate, water level, and flow velocity; five remote sensing features: chlorophyll a concentration, suspended solids concentration, dissolved organic carbon index, water surface temperature, and transparency; four video features: water surface abnormal color index, floating matter density index, sewage outlet overflow indicator, and approximate water turbidity value; 32 spectral fingerprint features: remote sensing reflectance; two spatiotemporal codes: timestamp code and grid ID code; and three historical trend features: 7-day moving average, 14-day rate of change, and seasonal deviation.

[0040] Furthermore, to ensure that features with different dimensions and numerical ranges receive appropriate weights in the model, the unified feature vector is standardized. For numerical continuous features, the Z-score standardization method is used. For categorical features, such as the overflow indicator OF, the binary encoding remains unchanged, as this feature itself already has standardized 0-1 values. For periodic time features, such as months, a sine-cosine encoding method is used.

[0041] S103: Input the unified feature vector into the preset water quality mechanism model, the preset machine learning model and the preset deep learning model respectively for processing to obtain multiple water quality index prediction values.

[0042] In S103 above, while the preset water quality mechanism model, based on physicochemical processes, possesses good interpretability and long-term trend prediction capabilities, its parameter calibration process is complex and its response speed to sudden pollution events is slow. The preset machine learning model can quickly capture nonlinear time-series features and respond promptly to short-term anomalies, but its extrapolation ability is weak in extreme scenarios lacking historical training samples. The preset deep learning model has a strong ability to capture long-distance time-series dependencies and is suitable for medium-term prediction, but it requires large computational resources and exhibits black-box characteristics. To fully leverage the advantages of various models and compensate for their limitations, a multi-model parallel processing architecture is adopted. The 42-dimensional unified feature vector generated above is simultaneously input into the preset water quality mechanism model, the preset machine learning model, and the preset deep learning model for processing. This allows each model to output predicted water quality indicators based on its specific modeling principles and algorithmic structure for different prediction time scales, thereby constructing a full-time-domain prediction system covering short-term, medium-term, and long-term predictions.

[0043] Before inputting the unified feature vector into the three prediction models for processing, the construction and training of the three prediction models must be completed first. For the preset water quality mechanism model, the internationally widely used SWAT (Soil and Water Assessment Tool) watershed water quality model is adopted as the core engine. The SWAT model is a distributed hydrological and water quality simulation model based on physical processes, capable of simulating complex processes such as hydrological cycle, sediment transport, nutrient migration and transformation, and pollutant degradation within the watershed. The first step is to discretize the watershed space. Based on the watershed DEM data and river network extraction results, the target watershed is divided into several sub-watershed units, and each sub-watershed is further subdivided into hydrological response units (HRUs) with different land use types. For example, in the application of a tributary of the Yangtze River, the 3,500 square kilometer watershed is divided into 58 sub-watersheds and 326 HRU units, each HRU having a unique combination of soil type, slope, and land use. The second step is to establish the model input database. The input data required by the SWAT model includes meteorological data (daily rainfall, maximum and minimum temperatures, solar radiation, wind speed, relative humidity), soil data (soil type, texture, organic matter content, saturated hydraulic conductivity), land use data (distribution of cultivated land, forest land, construction land, etc.), river cross-section parameters (river width, river depth, Manning roughness coefficient), and point source pollution data (discharge outlet location, discharge volume, pollutant concentration). The meteorological features (5 dimensions) and hydrological features (3 dimensions) in the unified feature vector are directly mapped to the meteorological driving file and hydrological boundary conditions required by the SWAT model. Water quality indicators (8 dimensions) are used for model initialization and calibration. The third step is model parameter calibration and validation, which is the most critical step in the construction of the SWAT model. The SUFI-2 (Sequential Uncertainty Fitting) algorithm was used to automatically calibrate the sensitive parameters of the model. The main calibration parameters included the curve number CN (reflecting the watershed's runoff capacity), soil evaporation compensation coefficient ESCO, groundwater delay time GW DELAY, channel Manning roughness coefficient CH N, channel effective hydraulic conductivity coefficient CH K2, biodegradation rate constant RHOQ, organic nitrogen mineralization rate CMN, and nitrification rate NPERCO, totaling 23 key parameters. During the calibration process, the system used historical monitoring data from three national-level monitoring sections within the watershed over the past five years as observations. Iterative optimization ensured that the Nash efficiency coefficient (NSE) between the simulated and observed values ​​was greater than 0.75, and the coefficient of determination (R²) was greater than 0.80. After thorough calibration, the SWAT model can accurately simulate the long-term evolution trends of watershed hydrological processes and water quality indicators. The fourth step is the design of the model operation mechanism. When a unified feature vector X∈R is received... 4² Then, the meteorological, hydrological, and water quality indicators are extracted, the input file of the SWAT model is updated, and the model is started to perform continuous simulation on a daily scale, outputting the daily water quality indicator prediction sequence for the next 30 days, including the predicted concentration values ​​of five key indicators such as COD, NH3-N, TP, TN, and DO at each monitoring section, denoted as ySWAT(t+Δt), where Δt represents the prediction duration. For long-term trend prediction, Δt is usually set to 7 to 30 days.

[0044] For the pre-defined machine learning model, a Long Short-Term Memory (LSTM) network is used as the core algorithm architecture, specifically for short-term early warnings of 1 to 7 days. LSTM is a special recurrent neural network structure that, by introducing input gate, forget gate, and output gate mechanisms, can effectively solve the gradient vanishing problem of traditional RNNs when processing long sequences. It is particularly suitable for capturing nonlinear dynamic features and short-term mutation patterns in water quality time-series data. The first step is dataset preparation and feature engineering. Water quality monitoring data, meteorological data, hydrological data, remote sensing inversion data, and video analysis data from the past three years are extracted from the historical database. Following the method in step S102, a unified feature vector sequence {X(tT), X(t-T+1), ...,X(t-1)} for historical moments is generated, where T is the backtracking window length, set to 30 days (T=30). At the same time, the measured water quality index values ​​{Yo(t-T+1), Yob(t-T+2), ...,Yo(t)} for the corresponding moments are extracted as labels for supervised learning. To enhance the model's temporal modeling capabilities, a sliding window process is applied to the feature vectors, constructing training samples in the format of (input sequence, output value) pairs, such as ([X(t-7), X(t-6), ..., X(t-1)], Yo(t)), which uses the feature vector sequence of the past 7 days to predict the water quality index value of the day. This data organization method enables the LSTM model to learn the temporal dependencies of water quality changes. The second step is the design of the LSTM network structure. The constructed LSTM model includes an input layer, three LSTM hidden layers, a fully connected layer, and an output layer. The input layer receives a tensor of shape (batch size, sequence length, input dim), where sequence length=7 indicates that the input sequence length is 7 days, and input dim=42 indicates the feature dimension at each time step. The first LSTM layer contains 128 hidden units, using tanh as the activation function and Dropout with a value of 0.2 to prevent overfitting. The second LSTM layer contains 64 hidden units, also using Dropout regularization. The third LSTM layer contains 32 hidden units, serving as the final stage for feature extraction. The output of each LSTM layer undergoes dimensionality transformation through a fully connected layer containing 16 neurons and using ReLU as the activation function. The final output layer produces five nodes, corresponding to the predicted values ​​of five water quality indicators: COD, NH3-N, TP, TN, and DO. The third step involves model training and hyperparameter optimization. The dataset is divided into training, validation, and test sets in an 8:1:1 ratio. The Adam optimizer is used for model training, with an initial learning rate of 0.001. A learning rate decay strategy is employed, reducing the learning rate to 0.5 when the validation set loss does not decrease for five consecutive epochs.The loss function used is mean squared error (MSE), the batch size is set to 32, the total number of training epochs is 200, and an early stopping mechanism is set: training stops when the validation set loss does not improve for 15 consecutive epochs. After training, the final LSTM model's mean absolute percentage error (MAPE) on the test set is controlled within 12%, and the accuracy for identifying sudden pollution events reaches 87%. The fourth step is the model inference mechanism. When a unified feature vector X(t) is received, the feature vectors {X(t-6), X(t-5), ..., X(t-1)} of the past 6 days are extracted from the historical cache and combined with the current feature vector X(t) to form an input sequence of length 7. This sequence is then input into the trained LSTM model. After forward propagation, the model outputs the predicted water quality index sequence yLSTM(t+1), yLSTM(t+2), ..., yLSTM(t+7) for the next 1 to 7 days.

[0045] For the pre-defined deep learning model, the Transformer architecture is adopted, specifically for mid-term predictions of 7 to 15 days. The Transformer model utilizes a self-attention mechanism, enabling parallel processing of all positional information within the sequence and automatic learning of dependencies between different time steps. This characteristic offers a unique advantage in capturing long-range dependencies in water quality time-series data. The first step is positional encoding and input embedding design. Since the Transformer itself lacks the ability to process sequence order information, positional encoding needs to be added to the input feature vector. A sine-cosine positional encoding scheme is adopted. For the t-th time step in the input sequence, the i-th dimension of the positional encoding vector PE(t) is calculated as PE(t, 2i) = sin(t / 10000). (2i / dm) ) and PE(t, 2i+1)=cos(t / 10000) (2i / dm) The model's embedding dimension is dm=256. The input embedding layer maps the 42-dimensional unified feature vector to a 256-dimensional embedding vector through a linear transformation, then adds it to the corresponding positional encoding vector to obtain the input representation containing positional information. The second step is the construction of the Transformer encoder. The designed Transformer model contains 6 encoder layers, each consisting of a multi-head self-attention sub-layer and a feedforward neural network sub-layer. The multi-head self-attention mechanism uses 8 attention heads, each with a dimension of 32 (total embedding dimension 256 divided by the number of heads 8), enabling it to learn dependencies within sequences from different representation subspaces. The self-attention calculation process involves transforming the input embedding vector through three linear transformations to obtain the query vector Q, key vector K, and value vector V, then calculating the attention weights Attention(Q, K, V) = softmax(QK). T / √dk)V, where dk=32 is the dimension of the key vector. Multi-head attention concatenates the outputs of the eight heads and then performs a linear transformation to obtain the output of this sub-layer. The feedforward neural network sub-layer contains two linear transformations and a ReLU activation function. The first linear layer expands the 256-dimensional array to 1024-dimensional array, and the second linear layer compresses the 1024-dimensional array back to 256-dimensional array. Residual connections and layer normalization are used after each sub-layer to improve the training stability of the model. The third step is the design of the decoder and output layer. Since this task is a sequence-to-sequence prediction task, the system adds two Transformer decoder layers after the encoder. The decoder structure is similar to the encoder, but an encoder-decoder attention sub-layer is added between the multi-head self-attention sub-layer and the feedforward sub-layer to focus on the encoder's output information. The decoder output passes through linear layers and a softmax layer to generate predicted water quality indicators for eight time steps, from 7 to 15 days. The fourth step is the model training strategy. Historical data is used to construct training sample pairs (input sequence, output sequence), with the input sequence length set to 14 days and the output sequence length to 8 days (corresponding to predictions for days 7 to 15). During training, a teacher forcing strategy is employed, using real historical labels as decoder input during the decoding phase to accelerate model convergence. The optimizer uses the Adam optimizer with warmup, with the learning rate linearly increasing to a peak of 0.0001 in the first 4000 steps, then decaying according to the learning rate scheduler. The Huber loss function is used. After 100 epochs of training, the Transformer model achieves a MAPE of 15.2% on the mid-term prediction task and an accuracy of 82% for trend prediction of water quality indicators. The fifth step is the model inference process. When a unified feature vector X(t) is received, the feature vector sequence {X(t-13), X(t-12), ..., X(t)} of the past 14 days is extracted as the encoder input. The encoder output goes through the autoregressive generation process of the decoder to predict the water quality index values ​​from day 7 to day 15 step by step, and the predicted sequence yTransformer(t+7), yTransformer(t+8), ..., yTransformer(t+15) is obtained.

[0046] After constructing the three prediction models, the system proceeds to the parallel processing stage of the unified feature vector. When the watershed water environment monitoring system collects the latest multi-source heterogeneous data at time t and generates the unified feature vector X(t)∈R... 4² Subsequently, the feature vector is synchronously sent to the inference engines of the three prediction models. In the SWAT mechanism model processing channel, the unified feature vector undergoes data format conversion, extracting temperature, humidity, wind speed, rainfall, and air pressure from the meteorological features. This data is then written into the meteorological input file according to the data format required by the SWAT model. The file format is the standard SWAT weather station file format, containing fields such as date, maximum temperature, minimum temperature, rainfall, solar radiation, wind speed, and relative humidity. The flow rate, water level, and velocity data from the hydrological features are updated in the SWAT model's channel boundary condition file, specifying the inflow flow rate and water level at each cross-section of the main channel. The concentration values ​​of COD, NH3-N, TP, TN, and DO from the water quality indicators are updated in the point source pollution file and the initial water quality condition file, ensuring that the model starts simulating from the current real-world conditions. After updating the input file, the executable file of the SWAT model is invoked to start a daily-scale continuous simulation. Internally, the model performs daily calculations according to the governing equations of physical processes such as hydrological cycle, surface runoff, groundwater flow, river confluence, and pollutant migration and transformation. The simulation considers the impact of multiple mechanisms on water quality, including rainfall runoff erosion, point source pollution emissions, river self-purification, sedimentation, and biodegradation. After the simulation is complete, the predicted daily water quality indicators for each monitoring section for the next 30 days are extracted from the SWAT model's output file. The output format is a time series array ySWAT=[ySWAT(t+1), ySWAT(t+2), ..., ySWAT(t+30)], with each time step containing the predicted concentrations of five water quality indicators, forming a 30×5 prediction matrix. Since a single run of the SWAT model typically takes 2 to 5 minutes, an asynchronous parallel computing strategy is adopted, running the SWAT model on a background server without blocking the inference process of other models.

[0047] In the LSTM machine learning model processing channel, historical feature vectors from the past 6 days are retrieved from a unified feature vector cache database and concatenated with the current feature vector X(t) in chronological order to form a three-dimensional tensor of shape (1, 7, 42). The first dimension (1) represents single-sample inference with a batch size of 1, the second dimension (7) represents the length of the input sequence, and the third dimension (42) represents the feature dimension. This tensor is fed into the trained LSTM model for forward propagation computation. In the input layer, the tensor first undergoes an embedding transformation. Although LSTM does not require an additional embedding layer, the system standardizes the input features to ensure that the numerical range is suitable for neural network computation. In the first LSTM hidden layer, the hidden state h0 and cell state c0 are initialized as zero vectors. Then, the input sequence is processed sequentially according to time steps. The computation process at each time step t includes the forget gate determining how much historical information is forgotten, the input gate and candidate cell states determining how much new information is updated to obtain the cell state update, and the output gate and hidden state generating the output for the current time step. After the first LSTM layer processes seven time steps, the hidden state sequence at the last moment is passed to the second LSTM layer for further processing. Through the layer-by-layer feature extraction of the three LSTM layers, the model captures the water quality change patterns and short-term trend features contained in the input sequence. The output vector of the third LSTM layer has a dimension of 32. This vector contains a high-level semantic representation of the water quality time series data over the past seven days. It is then fed into a fully connected layer for linear transformation. The 16 neurons in the fully connected layer map the 32-dimensional vector into a 16-dimensional intermediate representation through the weight matrix Wfc and the bias vector bfc. Nonlinearity is introduced through the ReLU activation function. Finally, the five neurons in the output layer correspond to the five water quality indicators, and the predicted values ​​are directly output through linear transformation without using an activation function to ensure the continuity of the output values. For short-term early warning tasks, it is necessary to predict water quality index values ​​for the next 1 to 7 days. Therefore, the LSTM model adopts a multi-step prediction strategy, which has two implementation methods: one is recursive prediction, that is, using the predicted result of day 1 and historical data to form a new input sequence to predict day 2, and so on; the other is direct multi-output, that is, the model outputs the predicted values ​​of 7 time steps simultaneously during training. This application adopts the direct multi-output method, by setting 7*5=35 neurons in the output layer to output the predicted values ​​of 5 water quality indicators for the next 7 days at once, avoiding the error accumulation problem of recursive prediction. Finally, the LSTM model outputs a prediction tensor of shape (1, 7, 5), which is converted into a time series array yLSTM=[yLSTM(t+1), yLSTM(t+2), ..., yLSTM(t+7)], a prediction matrix of dimension 7*5 after post-processing. The LSTM model has a single inference time of only 20 to 50 milliseconds, with extremely high real-time response capability, and is particularly suitable for rapid early warning scenarios of short-term sudden pollution.

[0048] In the Transformer deep learning model processing pipeline, the processing flow is similar to LSTM but more complex. Historical feature vectors from the past 14 days are retrieved from a unified feature vector cache database and concatenated with the current feature vector X(t) to form an input tensor of shape (1, 14, 42). This tensor, after entering the Transformer model, first undergoes a linear transformation in the input embedding layer, mapping the 42-dimensional feature vector at each time step to a 256-dimensional embedding vector. This mapping process is achieved through the weight matrix Wemb∈R. (42*256) The bias vector bemb is used for implementation, and the calculation formula is Xemb = X·Wemb + bemb. Position encoding vectors PE(1), PE(2), ..., PE(14) are added to the embedding vectors at 14 time steps respectively. The input representation containing position information is obtained by element-wise addition operation Xpos = Xemb + PE, with a shape of (1, 14, 256). This input representation is fed into a stack of 6 Transformer encoders for processing. In the first encoder layer, the multi-head self-attention sublayer first generates a query matrix Q∈R through three linear transformations of the input. (14*256) Key matrix K∈R (14*256) Sum matrix V∈R (14*256) Then, Q, K, and V are split into 8 heads according to the embedding dimension, with each head having a dimension of 32. The attention of the h-th head is calculated as Attention. h =softmax(Q h K h T / √32)V h Q h K h T ∈R (14*14) Let Q be the attention score matrix, representing the correlation between each position in the sequence and other positions; h K h V hLet represent the query, key, and value vectors of the h-th head, respectively. The outputs of the eight heads are concatenated and then linearly transformed to obtain the multi-head attention output. This output is residually connected to the input and then normalized using LayerNorm. Next, the feedforward neural network sublayer independently performs nonlinear transformations on the vector at each position. First, it expands the 256-dimensional vector to 1024 dimensions through the first linear layer, applying the ReLU activation function. Then, it is compressed back to 256 dimensions through the second linear layer, again using residual connections and layer normalization. After layer-by-layer processing by the 6-layer encoder, each position of the input sequence obtains a context representation vector incorporating global information. The encoder finally outputs an encoded representation tensor of shape (1, 14, 256). This encoded representation enters the Transformer decoder for intermediate prediction generation. The decoder operates in an autoregressive manner. Initially, the decoder's input is a special start-label vector. The masked multi-head self-attention sublayer inside the decoder ensures that each position only focuses on previous positions, preventing information leakage. The encoder-decoder attention sublayer enables the decoder to focus on the global information output by the encoder. After processing by two layers of decoders, the system adds a linear projection layer to the decoder output, projecting the 256-dimensional vector into a 5-dimensional vector, corresponding to the predicted values ​​of the five water quality indicators. Through eight steps of autoregressive decoding, the model generates predicted values ​​of the water quality indicators for eight time steps from day 7 to day 15 in the future. The output is a tensor of shape (1, 8, 5), which is converted into a time series array yTransformer=[yTransformer(t+7), yTransformer(t+8), ..., yTransformer(t+15)], a prediction matrix of dimension 8*5.

[0049] Complete the unified eigenvector X(t)∈R 4 The three-way parallel processing of ² yielded three sets of predicted water quality indicators. The preset water quality mechanism model SWAT output the long-term trend prediction ySWAT∈R for the next 30 days. (30*5) The preset machine learning model LSTM outputs a short-term early warning prediction yLSTM∈R for the next 1 to 7 days. (7*5) The preset deep learning model Transformer outputs the medium-term prediction yTransformer∈R for the next 7 to 15 days. (8*5)These three sets of forecasts are complementary in terms of time scale. The short-term forecast focuses on rapid changes and emergencies within the next week, the medium-term forecast focuses on trend evolution and cyclical fluctuations over the next two weeks, and the long-term forecast focuses on macroeconomic trends and seasonal characteristics over the next month. Each set of forecasts includes predicted concentrations of five key water quality indicators: Chemical Oxygen Demand (COD) (mg / L), Ammonia Nitrogen (NH3-N) (mg / L), Total Phosphorus (TP) (mg / L), Total Nitrogen (TN) (mg / L), and Dissolved Oxygen (DO) (mg / L). These indicators are core parameters for evaluating the watershed's water environment quality and can comprehensively reflect the degree of organic pollution, nutrient status, and redox conditions of the water body. The three sets of forecasts, along with corresponding timestamps, monitoring section information, model identifiers, and other metadata, are stored in the forecast results database.

[0050] S104: Obtain the prediction error of each model within the historical backtracking window, and calculate the target weight of each model at the current moment based on the prediction error.

[0051] In S104 above, during the actual operation of the intelligent early warning system for watershed water environment, the preset water quality mechanism model (SWAT model), preset machine learning model (LSTM model), and preset deep learning model (Transformer model) each have different prediction characteristics and applicable ranges. A single model is difficult to adapt to the complexity and diversity of watershed water quality changes. Traditional multi-model ensemble forecasting methods usually use fixed weights or simple averaging for fusion, but this method ignores the dynamic differences in the prediction performance of each model at different times and under different hydrological conditions, making it difficult to optimize the ensemble forecast accuracy. To solve this problem, this application adopts a dynamic weight adaptive allocation method based on historical prediction errors. By quantitatively evaluating the recent actual prediction performance of each model, higher weights are given to models with better prediction performance, thereby achieving the self-optimization goal of "higher weight for smaller errors".

[0052] The process involves obtaining the prediction errors of each model within the historical backtracking window, and calculating the target weights of each model at the current moment based on these prediction errors. Specifically, this includes: obtaining the predicted values ​​of each model at historical moments and the corresponding measured water quality index values ​​from the historical backtracking window; calculating the prediction errors of each model using the first formula; calculating the reciprocals of each prediction error and normalizing them using the second formula to obtain the initial weights of each model at the current moment; obtaining rainfall data, river hydrological data, and upstream reservoir data from multi-source heterogeneous data; determining the hydrological period of the target watershed at the current moment based on the rainfall data, river hydrological data, and upstream reservoir data; matching the corresponding hydrological correction factor based on the hydrological period; correcting the correction factor and the initial weights of each model using the third formula, and normalizing the corrected weights to obtain the target weights of each model at the current moment.

[0053] Specifically, the length N of the historical backtesting window is first set. This parameter determines the historical time span referenced when evaluating the predictive performance of each model. In practical applications, the choice of N value needs to balance timeliness and stability: a N value that is too small (e.g., N < 7 days) will lead to drastic fluctuations in weights and make the model susceptible to interference from occasional outliers; a N value that is too large (e.g., N > 60 days) will reduce the sensitivity to water quality change trends and make it difficult to reflect the latest changes in model performance in a timely manner. After extensive experimental verification and engineering practice, N = 30 days can be used as the default configuration. That is, when calculating model weights, the historical prediction data of the past 30 days is analyzed back. This time window can both accumulate sufficient statistical samples to ensure the reliability of the evaluation results and maintain the responsiveness to recent water quality change patterns.

[0054] After determining the historical backtracking window, the predicted values ​​of each model at historical moments and the corresponding measured water quality index values ​​are extracted from the database. Taking the weight calculation of a certain watershed at 15:00 on May 12, 202x as an example, the historical prediction sequences of key water quality indicators such as COD, NH3-N, and TP for each model during the period from April 13, 202x to May 12, 202x (a total of 30 days) are obtained, along with the actual measured value sequences collected by the online water quality monitoring equipment at the corresponding moments. For the SWAT mechanism model, the COD prediction sequence {ySWAT(t-1), ySWAT(t-2), ..., ySWAT(t-30)} is extracted based on upstream pollution source emissions, meteorological and hydrological conditions, and river hydrodynamic parameters. For the LSTM machine learning model, the prediction sequence {yLSTM(t-1), yLSTM(t-2), ..., yLSTM(t-30)} is extracted after training based on historical water quality time series data. For the Transformer deep learning model, the prediction sequence {yTransformer(t-1), yTransformer(t-2), ..., yTransformer(t-30)} is extracted after capturing long-distance dependencies using a self-attention mechanism. Meanwhile, the measured COD concentration values ​​at the corresponding time point were retrieved from the water quality monitoring data table as a sequence {Yo(t-1), Yo(t-2), ...,Yo(t-30)}. These measured values ​​were verified through the quality control process to eliminate abnormal data points caused by equipment failure or human interference, ensuring the reliability of the evaluation benchmark.

[0055] After obtaining the complete predicted and measured value sequences, the prediction errors of each model are quantified using the first formula. The first formula is as follows: ; Among them, E i Y(t) represents the prediction error of the model at time t, and Y0(tj) represents the measured water quality index value at the historical time tj; i (tj) represents the model's predicted value at historical time tj; N represents the length of the historical backtracking window; i represents the model index, and i∈{preset water quality mechanism model, preset machine learning model, preset deep learning model}; j represents the offset index of the historical time. The first formula adopts the average absolute percentage of relative error, fully considering the differences in the numerical range of water quality indicators and the fairness of the assessment. In the first formula, the numerator |Y0(tj)-y iThe formula (tj) calculates the absolute deviation between the predicted value and the measured value of model i at historical time tj. This deviation reflects the direct difference between the predicted result and the actual situation. The denominator Y0(tj) normalizes the deviation, unifying water quality indicators of different dimensions and numerical scales under the framework of relative error for comparison. For example, COD concentration is usually in the range of tens to hundreds of mg / L, while TP concentration may only be a few tenths of a mg / L. If absolute error is used for evaluation, high numerical indicators will dominate the error calculation, while relative error can fairly reflect the predictive ability of each model for different indicators. Multiplying by 100% in percentage form makes the error results more intuitive and easier for engineers to understand and apply.

[0056] For the offset index j of a historical time, iterate from j=1 to j=N, that is, calculate the relative error of each time point from the previous day (t-1), the two days before (t-2), up to the N days before (tN). At each historical time tj, first extract the measured water quality index value Y0(tj), for example, the measured COD concentration at 15:00 on May 11, 202x is 78mg / L; then extract the predicted value yᵢ(tj) of the SWAT model at that time, assuming that the predicted COD concentration at 15:00 on May 11, 202x is 82mg / L; substitute the above value into the first formula to calculate the relative error of the model at that time: |78-82| / 78 * 100% ≈5.13%. Repeat the above calculation process for all 30 historical moments from j=1 to j=30 to obtain 30 relative error values. Summing these values ​​Σ|j=1→30| and dividing by N=30 yields the average prediction error E of the model within the 30-day window. SWAT (t). Similarly, the exact same computational process is performed on the LSTM model and the Transformer model, ultimately yielding the prediction error values ​​E for each of the three models. SWAT (t), E LSTM (t) and E Transformer (t). Through the above calculation based on the first formula, the quantitative prediction error of each model within the historical backtracking window was obtained. This error value objectively reflects the ability of each model to track the recent trend of water quality changes and the accuracy of prediction.

[0057] The prediction errors of each model calculated above are converted to their inverses, but this inverse is a negative correlation embedded in the exponential function. The second formula is as follows: ; Among them, w i (t) represents the initial weights of the model at time t, and satisfies α represents the preset sensitivity coefficient; the larger the α value, the more significant the difference caused by the same error variation; M represents the total number of models participating in the integration, k represents the loop index variable for model summation, and Ek (t) represents the prediction error of model k at time t. e in the second formula -α*Ei(t) This is the numerator term, where the negative sign (-) ensures the inverse relationship between error and weight, i.e., error E i The larger (t) is, the smaller the value of the numerator.

[0058] Taking the actual calculation of a certain watershed at 15:00 on May 12, 202x as an example, assuming that the prediction errors of the three models have been obtained through the previous step, the prediction error E of the SWAT mechanism model is as follows: SWAT (t) = 4.12%, the prediction error E of the LSTM machine learning model LSTM (t) = 3.28%, the prediction error E of the Transformer deep learning model Transformer (t) = 2.57%, at which point the total number of models participating in the integration is M = 3. First, the value of the preset sensitivity coefficient α is set. In this application, this parameter is set to α = 5.0 by default. This value is the empirically optimal value obtained through a large number of experimental verifications and engineering practice optimizations, which can maintain the rationality of weight allocation while avoiding weight oscillation caused by oversensitivity.

[0059] After determining the preset sensitivity coefficients, the inverse term of the exponential error for each model is calculated. For the SWAT model, the prediction error E is... SWAT (t) = 4.12%, converted to decimal form 0.0412, and then substituted into the numerator of the second formula, yields 0.8138; for the LSTM model, substituted into the numerator of the second formula yields 0.8487; for the Transformer model, substituted into the numerator of the second formula yields 0.8794. These three values ​​represent the "original weight contribution values" of each model after error inverse and exponential amplification, respectively. It can be seen that the Transformer model has the smallest prediction error and the largest exponential inverse value (0.8794), while the SWAT model has the largest prediction error and the smallest exponential inverse value (0.8138), initially demonstrating the difference in performance.

[0060] The denominator in the second formula This involves summing the inverse exponentiation of all the models involved in the ensemble. Physically, this constructs a normalized baseline, ensuring that the weights of each model are between 0 and 1, and the sum is strictly equal to 1. Using a loop index variable k, all models are iterated through (k=1 represents SWAT, k=2 represents LSTM, k=3 represents Transformer), and the denominator is calculated as 0.8138 + 0.8487 + 0.8794 = 2.5419. This denominator serves as a normalization factor, standardizing the inverse exponentiation of each model and converting it into initial weights that meet the probability distribution requirements.

[0061] For the SWAT model, the initial weights wSWAT(t) at the current time t are calculated as follows: wSWAT(t) = 0.8138 / 2.5419 = 0.3201. This weight value indicates that the SWAT model should account for approximately 32.01% of the ensemble forecast at the current time. For the LSTM model, the initial weights wLSTM(t) = 0.8487 / 2.5419 = 0.3339, accounting for approximately 33.39%. For the Transformer model, the initial weights wTransformer(t) = 0.8794 / 2.5419 = 0.3460, accounting for approximately 34.60%. The normalization constraint for the initial weights can now be verified: wSWAT(t) + wLSTM(t) + wTransformer(t) = 0.3201 + 0.3339 + 0.3460 = 1.0000, which is fully satisfied. The mathematical requirements ensured the rationality of the subsequent weighted fusion calculation.

[0062] After obtaining the initial weights of each model through the second formula, how to further optimize the weight allocation to adapt to the challenges of different hydrological conditions? Three key types of data related to hydrological period determination are extracted from the multi-source heterogeneous data fusion middleware. Rainfall data comes from the meteorological department's real-time precipitation monitoring network, including hourly rainfall, cumulative rainfall, and rainfall intensity at various meteorological stations within the target watershed and upstream catchment area. The system spatializes the discrete station rainfall data into watershed average rainfall using the Thiessen polygon method or inverse distance weighted interpolation method, and calculates the cumulative rainfall over the past 24 hours (R24h) and the cumulative rainfall over the past 72 hours (R72h) as the first dimension feature for hydrological period determination. River hydrological data are obtained from the real-time monitoring system of hydrological stations, including flow rate Q(t), water level H(t), and flow velocity u(t) at key sections. The 20th percentile (Qper20) and 80th percentile (Qper80) of the flow rate (representing the threshold for the dry season) are statistically obtained from historical hydrological series. The hydrological period type is preliminarily classified by comparing the relative position of the current measured flow rate Q(t) with these two thresholds. Upstream reservoir data includes reservoir storage V(t), outflow Qout(t), and the opening status of the floodgates. This data is reported in real-time through the water resources department's reservoir dispatching system. When Qout(t) is significantly greater than the average daily outflow and the floodgate opening is >50%, it is identified as a reservoir flood discharge condition and needs to be specially marked as a special hydrological period.

[0063] The implementation process is explained in detail using the hydrological period determination at 08:00 on June 15, 202x, in a tributary of the Yangtze River as an example. First, rainfall data for the 24 hours preceding this time was retrieved. It was found that the average rainfall at five meteorological stations in the upstream catchment area reached 68 mm, with the maximum rainfall intensity at a single station reaching 12 mm / h, exceeding the rainstorm standard (50 mm / 24h). Simultaneously, the real-time flow rate at the control section of the basin was extracted as 1250 m³ / s, while the historical statistics for this section were Qper20 = 180 m³ / s and Qper80 = 850 m³ / s. The current flow rate significantly exceeded the Qper80 threshold by 47%. Further querying the dispatch records of a large upstream reservoir revealed that the reservoir initiated flood discharge at 20:00 on June 14th, with a current outflow rate of Qout = 680 m³ / s, an increase of 240% compared to the daily average outflow rate (approximately 200 m³ / s), and the floodgate opening reached 75%. Based on the above three-dimensional data characteristics, the rainfall intensity R24h=68mm>50mm and the flow rate Q(t)>Qper80 were first identified, which initially determined it to be a high-water season; then it was detected that the upstream reservoir was in flood discharge condition and the discharge duration was <24 hours, and finally it was determined that the hydrological period of the target watershed at the current moment was "flood season emergency" state, which is the highest priority hydrological period type and corresponds to a special weight correction strategy.

[0064] After determining the type of hydrological period the current moment falls in, the corresponding hydrological correction factor is matched from a preset hydrological period correction factor comparison table. Differentiated correction coefficients are pre-configured in advance according to different hydrological periods and different model types. For the dry season (flow rate Q<Qper20), the hydrological correction factor β_SWAT of the preset water quality mechanism model (SWAT) is set to 1.15, because the flow regime is stable and the hydrodynamic boundary conditions are clear in the dry season, and the hydrodynamic simulation based on the Saint-Venant equations and the water quality simulation based on the advection-diffusion equation of the SWAT model can accurately characterize the pollutant migration process, which has stronger physical interpretability than the data-driven model; while the correction factors of the preset machine learning model and deep learning model are uniformly set to β_ML=0.95, to moderately reduce the weight so as to avoid the risk of overfitting when historical similar samples are insufficient in the dry season. For the normal flow period (Qper20≤Q≤Qper80), the correction factors of all models are set to 1.00, that is, the initial weights are not corrected, and the dynamic weight allocation mechanism driven entirely by historical prediction errors is relied on, which embodies the design concept of "data-driven dominance under conventional conditions". For the wet season (Q>Qper80), the correction factor of the SWAT model is reduced to β_SWAT=0.90, because the water flow is highly turbulent and the complexity of river boundaries increases in the wet season, which amplifies the parameter uncertainty of the mechanism model; the correction factor of the machine learning model is increased to β_ML=1.10, to cope with abrupt hydrological changes by leveraging its strong capability of capturing nonlinear time series patterns. For flood season emergency scenarios (rainfall intensity >50mm / 24h or reservoir spillway discharge), the weight of the machine learning model is forcibly increased, with β_SWAT=0.70 and β_ML=1.30. This significant weight shift strategy aims to quickly respond to sudden pollution diffusion risks, since emergencies such as non-point source pollution entering rivers caused by rainfall and flood scouring in flood seasons and combined sewer overflows are highly time-sensitive, and the real-time response capability of data-driven models is better than that of mechanism models that require re-calibration of parameters. In actual engineering deployment, the hydrological correction factors can also be customized and adjusted according to the hydrological characteristics of different watersheds, which is not overly limited here.

[0065] Continuing the above example, after identifying that the current hydrological period is "flood season emergency", the following are obtained by matching from the correction factor comparison table: the hydrological correction factor corresponding to the SWAT model is β_SWAT=0.70, the hydrological correction factor corresponding to the LSTM model is β_LSTM=1.30, and the hydrological correction factor corresponding to the Transformer model is β_Transformer=1.30. At this time, the initial weights of the three models calculated through the second formula are respectively: w_SWAT(t)=0.3201, w_LSTM(t)=0.3339, w_Transformer(t)=0.3460. These initial weights reflect the performance ranking of each model based on the prediction errors of the past 30 days under conventional conditions.

[0066] The initial weights are corrected for hydrological periods using the third formula and then re-normalized to obtain the target weights. The third formula is as follows: ; Among them, W i (t) represents the target weight of the model at time t, βi represents the hydrological correction factor for model i corresponding to the current hydrological period, k represents the circular index variable for model summation, and w k (t) represents the initial weights of the model at time t, β k The model k represents the hydrological correction factor corresponding to the current hydrological period, and M represents the total number of models participating in the integration.

[0067] The numerator W of the third formula i (t)*βi multiplies the initial weights of model i by the corresponding hydrological correction factors to obtain the corrected weight contribution value of the model after hydrological period adjustment; the denominator part This involves summing the corrected weight contributions of all M models participating in the integration, using this sum as a normalization factor to ensure that the target weights still satisfy the normalization condition. The constraints are as follows. The loop index variable k iterates from k=1 to k=M (M=3 in the three-model architecture). First, the modified weight contribution values ​​of each model are calculated: SWAT model is 0.3201*0.70=0.2241, LSTM model is 0.3339*1.30=0.4341, and Transformer model is 0.3460*1.30=0.4498. The normalization factor is calculated as 0.2241+0.4341+0.4498=1.1080.

[0068] For the SWAT model, the target weight during the current flood season emergency is calculated as: WSWAT(t) = 0.2241 / 1.1080 = 0.2023, a decrease of 9.78 percentage points (30.6%) compared to the initial weight of 0.3201. This fully reflects the proactive suppression strategy for the weight of the mechanistic model under flood season emergency conditions, avoiding the impact of its parameter calibration lag on the real-time response capability of the ensemble forecast. For the LSTM model, the target weight is WLSTM(t) = 0.4341 / 1.1080 = 0.3918, an increase of 5.79 percentage points (17.3%) compared to the initial weight of 0.3339. For the Transformer model, the target weight is WTransformer(t) = 0.4498 / 1.1080 = 0.4059, an increase of 5.99 percentage points (17.3%) compared to the initial weight of 0.3460. At this point, the normalization constraint of the target weights is verified: WSWAT(t) + WLSTM(t) + WTransformer(t) = 0.2023 + 0.3918 + 0.4059 = 1.0000, which fully satisfies the probability distribution requirements.

[0069] S105: The predicted water quality indicators output by each model are weighted and summed with the corresponding target weights to obtain the comprehensive water quality indicator prediction value, and early warning information is generated based on the comprehensive water quality indicator prediction value.

[0070] In S105 above, the predicted values ​​of water quality indicators at the next Δt time are extracted from the prediction output modules of each model. A detailed example is provided using the current time t as 08:00 on June 15, 202x, in a tributary of the Yangtze River, to predict the water quality status for the next Δt = 24 hours (i.e., 08:00 on June 16, 2024). The preset water quality mechanism model SWAT, based on the current hydrological boundary conditions and meteorological forecast data, outputs the predicted values ​​of water quality indicators at key sections 24 hours later: ySWAT(t+24h) = [COD = 45.2 mg / L, NH3-N = 1.82 mg / L, TP = 0.18 mg / L, TN = 3.45 mg / L, DO = 6.8 mg / L].

[0071] The pre-set machine learning model LSTM extracts the water quality monitoring sequence and multi-source feature vector sequence of the cross section over the past 30 days from the historical time series database. It captures the nonlinear correlation pattern in the time series data through a trained long short-term memory neural network and outputs the predicted water quality index values ​​for the next 24 hours: yLSTM(t+24h)=[COD=48.6mg / L,NH3-N=1.95mg / L,TP=0.21mg / L,TN=3.62mg / L,DO=6.5mg / L]. The pre-defined deep learning model Transformer uses a self-attention mechanism to capture long-distance temporal dependencies, while introducing a multi-head attention mechanism to associate the coupling effects between different water quality indicators, outputting the predicted water quality indicators for the next 24 hours: yTransformer(t+24h)=[COD=47.1mg / L,NH3-N=1.89mg / L,TP=0.19mg / L,TN=3.54mg / L,DO=6.7mg / L], which is between the predicted values ​​of SWAT and LSTM.

[0072] The predicted water quality indicators output by the three models constitute a prediction matrix ymatrix(t+24h), which is 3*5 dimensional (3 models * 5 water quality indicators). Simultaneously, the target weight vectors Wvec(t) = [WSWAT(t), WLSTM(t), WTransformer(t)] = [0.2023, 0.3918, 0.4059], calculated for each model under the current flood season emergency hydrological period, are obtained; this weight vector is 3×1 dimensional. Weighted summation is achieved using matrix multiplication: the comprehensive water quality indicator prediction vector yensemble(t+24h) = Wvec(t) T* ymatrix(t+24h), where T represents the transpose operation. For the COD index, the predicted COD values ​​of the three models are weighted and summed with their corresponding target weights to obtain the comprehensive predicted COD value. For example, the comprehensive predicted COD value = 0.2023*45.2 + 0.3918*48.6 + 0.4059*47.1 = 47.30 mg / L. Then, the NH3-N, TP, TN, and DO indices are calculated sequentially to obtain the comprehensive predicted values ​​of NH3-N, TP, TN, and DO, respectively. Finally, the comprehensive water quality index prediction vector Yensemble(t+24h) = [COD=47.30mg / L, NH3-N=1.899mg / L, TP=0.1958mg / L, TN=3.553mg / L, DO=6.643mg / L].

[0073] After obtaining the predicted values ​​of comprehensive water quality indicators, early warning information is generated based on these values. Specifically, this includes: dividing the predicted value of each water quality indicator in the comprehensive water quality indicator prediction by its corresponding preset standard limit to obtain a standardized index for each water quality indicator; calculating a comprehensive early warning index by weighting and summing the standardized indices using preset indicator weights; comparing the comprehensive early warning index with a first, second, and third early warning threshold, where the first early warning threshold is greater than the second early warning threshold, and the second early warning threshold is greater than the third early warning threshold; generating a severe early warning if the comprehensive early warning index is greater than or equal to the first early warning threshold; generating a moderate early warning if the comprehensive early warning index is less than the first early warning threshold but greater than or equal to the second early warning threshold; and generating a mild early warning if the comprehensive early warning index is less than the second early warning threshold but greater than or equal to the third early warning threshold.

[0074] Specifically, the preset standard limit values corresponding to each water quality indicator are extracted from the preset parameter configuration module. These standard limit values are determined according to the water function zoning and the category of water environment function zone to which the river basin belongs. For Class III water bodies in the Environmental Quality Standards for Surface Water GB3838-2002 (applicable to the secondary protection zones of centralized drinking water surface sources, fish and shrimp overwintering fields, etc.), the standard limit values of each indicator are: COD standard limit CCOD=20mg / L, NH3-N standard limit CNH3-N=1.0mg / L, TP standard limit CTP=0.2mg / L, TN standard limit CTN=1.0mg / L, DO standard limit CDO≥5mg / L. It should be noted that DO is a lower-limit indicator at this time, and a predicted value lower than the standard limit value means exceeding the standard. Each indicator predicted value in the comprehensive water quality indicator predicted value is divided by the corresponding preset standard limit value respectively, and the standardized index of each water quality indicator is calculated. For conventional upper-limit indicators (COD, NH3-N, TP, TN), the calculation formula of the standardized index is: Ij=Cj / Cstdj, where Ij is the standardized index of indicator j, Cj is the predicted value of indicator j in the comprehensive predicted value, and Cstdj is the standardized limit value of indicator j. When Ij>1, it indicates that the predicted value exceeds the standard limit, and the exceeding multiple is (Ij-1)*100%; when Ij≤1, it indicates that the predicted value does not exceed the standard, and the compliance margin is (1-Ij)×100%. For lower-limit indicators such as DO, the reciprocal processing is required for the calculation of the standardized index to maintain the consistency of "the larger the index, the higher the risk": IDO = CDO / DO (when DO<CDO) or IDO=0 (when DO≥CDO, assigning 0 means no risk).

[0075] Taking the predicted values ​​of the above comprehensive water quality indicators as an example, the standardized index of each indicator is calculated as follows: COD standardized index: ICOD = COD / CCOD = 47.30 mg / L / 20 mg / L = 2.365. NH3-N standardized index: INH3-N = NH3-N / CNH3-N = 1.899 mg / L / 1.0 mg / L = 1.899. TP standardized index: ITP = TP / CTP = 0.1958 mg / L / 0.2 mg / L = 0.979. TN standardized index: ITN = TN / CTN = 3.553 mg / L / 1.0 mg / L = 3.553. DO standardized index: Since the predicted DO value DO = 6.643 mg / L is higher than the standard limit CDO = 5 mg / L, indicating sufficient dissolved oxygen, the standardized index is set to IDO = 0 (no risk indicator), meaning that this indicator is not included in the risk assessment. Through the above standardization transformation, the standardized index vector Ivec=[ICOD, INH3-N, ITP, ITN,IDO]=[2.365, 1.899,0.979, 3.553, 0] is obtained. This vector unifies water quality indicators of different dimensions into the dimensionless "standard limit multiple" space, realizing cross-indicator comparability.

[0076] Furthermore, after obtaining the standardized indices for each water quality indicator, the multiple standardized indices are combined into a single comprehensive early warning index to achieve dimensionality reduction assessment. The measured value sequence {Cj(t-89), Cj(t-88), ..., Cj(t-1), Cj(t)} for each water quality indicator over the past 90 days is extracted from the historical monitoring database. For the COD indicator, the historical measured sequence is {38.2, 41.5, 39.8, ..., 45.6, 44.2} mg / L, with a total of 90 sample points. The historical measured values ​​are also standardized to obtain the historical standardized index sequence {Ij(t-89), Ij(t-88), ..., Ij(t-1)}. Taking COD as an example, the historical standardized index sequence is {1.91, 2.08, 1.99, ..., 2.28, 2.21}, which reflects the fluctuation characteristics of the COD indicator over the past 90 days. If an indicator fluctuates more in its historical sequence, its information entropy is smaller, indicating that it carries more effective information and should be given a higher weight. Conversely, if an indicator changes steadily (small standard deviation), its information entropy is large and its weight should be reduced. First, calculate the information entropy of the historical standardized index sequence of each indicator. For indicator j, normalize the historical standardized index sequence to a probability distribution and then calculate the information entropy Hj. The range of information entropy Hj is [0, ln(90)]. When Hj is closer to ln(90)≈4.50, it indicates that the sequence is more uniformly distributed and has less fluctuation. When Hj is closer to 0, it indicates that the sequence is concentrated and has greater fluctuation.

[0077] The information utility value of each indicator is calculated as dj = 1 - Hj / ln(90). The larger the information utility value, the stronger the discrimination ability of the indicator. The calculated values ​​are: dCOD = 1 - 3.82 / 4.50 = 0.151, dNH3-N = 1 - 3.65 / 4.50 = 0.189, dTP = 1 - 4.12 / 4.50 = 0.084, dTN = 1 - 3.48 / 4.50 = 0.227, and dDO = 1 - 4.25 / 4.50 = 0.056. The objective weights of each indicator are calculated by the entropy weight method using the normalized information utility values. First, the sum of information utility values ​​is calculated, and then the information utility values ​​of each indicator are divided by the sum of information utility values ​​to obtain the entropy weights of COD, NH3-N, TP, TN, and DO. Then, the entropy weight of each indicator is used as the preset indicator weight, and the preset indicator weight is used to perform a weighted summation of each standardized index to calculate the comprehensive early warning index.

[0078] After obtaining the comprehensive early warning index, it is compared with the first, second, and third early warning thresholds. Based on the comparison results, severe, moderate, or mild early warning information is generated, triggering the corresponding tiered response process. A threshold system is used, with the first early warning threshold set at 2.0, the second at 1.5, and the third at 1.0. The calculated comprehensive early warning index is compared with the first early warning threshold. If the comprehensive early warning index is greater than or equal to the first early warning threshold, a severe early warning information (Red Alert Level I) is generated. For example, if the comprehensive early warning index is 2.2698 and compared with the first early warning threshold of 2.0, since 2.2698 is greater than 2.0, the condition is met, and a severe early warning information is generated. After the severe early warning information is generated, it is automatically pushed out via multiple channels, including SMS, app push notifications, email, and telephone voice calls, to the responsible person for watershed management, requiring a response within 30 minutes. The emergency response plan is then activated, automatically accessing the electronic document "Emergency Response Plan for Sudden Water Pollution Incidents in the XX River Basin (Level I Response)". The plan's emergency response flowchart, responsibility assignment table, emergency supplies list, and other auxiliary decision-making information are simultaneously pushed to the emergency command platform. The flag in the severe warning information triggers the automatic activation of the dual-engine source tracing system, immediately invoking the hydrodynamic reverse tracing module and the spectral fingerprint comparison module to perform pollution source tracing calculations in parallel in the background. The suspected source ranking results are expected to be output within 2 hours.

[0079] If the comprehensive warning index does not reach the first warning threshold, the system continues to assess whether the comprehensive warning index is greater than or equal to the second warning threshold and less than the first warning threshold. If the comprehensive warning index is greater than or equal to the second warning threshold and less than the first warning threshold, a medium warning is generated, i.e., orange warning level II. For example, if the calculated comprehensive warning index is 1.75, satisfying 1.5 ≤ 1.75 < 2.0, a medium warning is generated, with a response time of 2 hours. The handling requirements are "the department head organizes an investigation and rectification within a limited time," the responsible person is downgraded to the head of the environmental protection bureau's enforcement section, the emergency response level is downgraded to level II, and the handling measures include "remotely retrieving online monitoring data of the discharge outlet for verification," "notifying relevant enterprises to conduct self-inspection of emission records," and "increasing the monitoring frequency to once per hour," etc., which is significantly weaker than a red warning.

[0080] If the comprehensive early warning index continues to decrease, it is determined whether the comprehensive early warning index is greater than or equal to the third early warning threshold and less than the second early warning threshold. If the comprehensive early warning index is greater than or equal to the third early warning threshold and less than the second early warning threshold, a mild early warning information is generated, i.e., a yellow warning level III. For example, if the comprehensive early warning index is 1.2, satisfying 1.0 ≤ 1.2 < 1.5, a mild early warning information is generated, with a response time of 24 hours. The handling requirements are "strengthen monitoring frequency and issue early warning notices," with the station chief as the responsible person. Handling measures include "sending early warning notices to the watershed management unit," "recommending sewage discharge units along the river to conduct self-inspections," and "maintaining regular monitoring frequency," etc. This is a suggestive early warning and does not trigger an emergency response. If the comprehensive early warning index is less than the third early warning threshold, it is determined to be a normal state, and no early warning information is generated. Only the status information "predicted water quality meets standards, comprehensive early warning index, no risk" is recorded in the daily monitoring report, maintaining the normal operation mode.

[0081] In one possible implementation, after obtaining the comprehensive water quality index prediction values ​​and generating tiered early warning information through the above steps, it is also necessary to conduct in-depth analysis from the perspective of time series evolution. This involves calculating the rate of change of water quality indicators to capture early signs of sudden pollution, and simultaneously identifying abnormal water quality deviation patterns by establishing seasonal benchmark values, generating sudden trend early warning information and periodic trend early warning information. Based on the current comprehensive water quality index prediction values ​​and historical prediction values, the rate of change of each water quality index is calculated using the fourth formula. If the rate of change is greater than a preset rate of change threshold, a sudden trend early warning information is generated. Based on historical water quality data for the same period, a seasonal benchmark value is established using the fifth formula, and the deviation between the current comprehensive water quality index prediction value and the seasonal benchmark value is calculated using the sixth formula. If the deviation is greater than a preset deviation threshold, a periodic trend early warning information is generated.

[0082] Specifically, the predicted water quality index values ​​for the current time t and the historical time t-Δt are extracted from the historical repository of comprehensive water quality index prediction values ​​to construct a time-series comparison dataset. Taking a monitoring section of a Yangtze River tributary as an example, assuming the current time t is 08:00 on June 16, 202x, and a preset time difference Δt = 1 hour is set, then the predicted comprehensive water quality index values ​​for time t and time t-Δt (i.e., 07:00 on June 16, 202x) need to be extracted. According to the above steps, the predicted comprehensive water quality index value Yensemble(t) = [COD = 47.30 mg / L, NH3-N = 1.899 mg / L, TP = 0.1958 mg / L, TN = 3.553 mg / L, DO = 6.643 mg / L] has been calculated at time t through multi-model integration. This predicted value represents the estimate of the water quality status for the next 24 hours based on the current multi-source data. The system retrieves the historical comprehensive water quality index prediction values ​​stored at time t-Δt from the time series prediction result database. Assuming the prediction value at this time is Yensemble(t-1h)=[COD=43.80mg / L,NH3-N=1.756mg / L,TP=0.1825mg / L,TN=3.312mg / L,DO=6.720mg / L], this prediction value is the prediction result of future water quality based on the data status at that time 1 hour ago.

[0083] The rate of change of each water quality indicator is calculated using the fourth formula, which is as follows: ; Among them, V j (t) represents the rate of change of the j-th water quality indicator at time t, C j (t) represents the predicted value of the j-th water quality indicator at time t, C j (t-∆t) represents the predicted value of the j-th water quality indicator at time t-∆t, where ∆t represents the preset time difference. It should be noted that C is used here... j (t) and C j (t-Δt) is not the measured value, but rather the predicted value of each indicator in the comprehensive water quality indicator prediction value. This design reflects profound technical considerations. If the rate of change is calculated using the measured value, it can only reflect "changes that have already occurred," significantly reducing the timeliness of the early warning; while using the predicted value to calculate the rate of change essentially assesses the "trend of the predicted trajectory," enabling early detection of future water quality deterioration. The fourth formula essentially calculates the first-order time derivative of the water quality indicator prediction value sequence, reflecting the instantaneous rate of change of the indicator on the time axis. When V j When (t)>0, it indicates that the predicted value of the indicator is rising, and the risk of pollution is increasing; when V j When (t) < 0, it indicates that the predicted value of the indicator is decreasing and the water quality is improving; when V jWhen (t)≈0, it indicates that the predicted value of the indicator is relatively stable and the status quo is maintained.

[0084] Taking the COD index as an example, substituting the predicted COD value at time t (COD(t) = 47.30 mg / L) and the predicted COD value at time t-Δt (COD(t-1h) = 43.80 mg / L) into the fourth formula, V COD (t) = [47.30 mg / L - 43.80 mg / L] / 1h = 3.50 mg / L·h. The calculation shows that the COD index is changing at a positive rate of 3.50 mg / L·h at the current moment, indicating that the predicted COD concentration is rising at a rate of 3.50 mg / L per hour over the past hour, a significant signal of worsening pollution. If this upward trend continues, the predicted COD value will reach 47.30 + 3.50 * 2 = 54.30 mg / L after 2 hours, more than twice the Class III water standard limit of 20 mg / L, indicating that the watershed is facing the risk of an acute pollution event.

[0085] The same calculation was performed on the NH3-N index: V NH3-N (t) = [1.899 mg / L - 1.756 mg / L] / 1h = 0.143 mg / L·h, the rate of change of NH3-N is 0.143 mg / L·h. TP index calculation: V TP (t) = [0.1958 mg / L - 0.1825 mg / L] / 1h = 0.0133 mg / L·h, the rate of change of TP is 0.0133 mg / L·h. TN index calculation: V TN (t) = [3.553 mg / L - 3.312 mg / L] / 1h = 0.241 mg / L·h, the rate of change of TN is 0.241 mg / L·h. DO index calculation: V DO (t) = [6.643 mg / L - 6.720 mg / L] / 1h = -0.077 mg / L·h, the rate of change of DO is negative -0.077 mg / L·h. The rates of change of each indicator are summarized to form the rate of change vector Vvec(t) = [V COD V NH3-N V TP V TN V DO=[3.50, 0.143, 0.0133, 0.241, -0.077] mg / L·h. This vector fully presents the dynamic evolution characteristics of each water quality indicator on the time axis. After calculating the change rate of each indicator, it is necessary to compare the change rate vector with the preset change rate threshold to determine whether a sudden change trend warning is triggered. The determination of the preset change rate threshold is a key technical parameter of this mechanism, which requires comprehensive consideration of multiple factors such as the ecotoxicological significance of the indicators, the hydrological characteristics of the watershed, and the statistical law of historical pollution events. The preset change rate threshold vCOD for COD is set to 2.0 mg / L·h, which is determined according to the statistics of 3-year historical monitoring data of a certain watershed. The preset change rate threshold vNH3-N for NH3-N is set to 0.15 mg / L·h. The preset change rate threshold vTP for TP is set to 0.02 mg / L·h. The preset change rate threshold vTN for TN is set to 0.20 mg / L·h. The preset change rate threshold vDO for DO is set to -0.10 mg / L·h (note that it is a negative threshold).

[0086] Compare the change rate of each indicator with the corresponding preset change rate threshold item by item. For COD, V COD (t)=3.50 mg / L·h > vCOD=2.0 mg / L·h, the judgment condition is satisfied, and a COD sudden change trend warning is triggered. For NH3-N, V NH3-N (t)=0.143 mg / L·h < vNH3-N=0.15 mg / L·h, the judgment condition is not satisfied, the trend warning is not triggered temporarily, but this change rate is marked as "close to the threshold" and included in the monitoring list. For TP, V TP (t)=0.0133 mg / L·h < vTP=0.02 mg / L·h, the judgment condition is not satisfied, and no trend warning is triggered. For TN, V TN (t)=0.241 mg / L·h > vTN=0.20 mg / L·h, the judgment condition is satisfied, and a TN sudden change trend warning is triggered. TN sudden change trend warning information is generated, and the risk assessment shows that "TN is rising at a rate exceeding the threshold by 20.5%. Combined with the current state of serious over-standard, it indicates that the nitrogen pollution load in the watershed has increased sharply, which may lead to accelerated eutrophication of downstream water bodies. It is recommended to immediately investigate agricultural non-point source pollution (such as farmland fertilization, livestock and poultry breeding wastewater) and the operation status of urban sewage treatment plants". For DO, V DO(t) = -0.077 mg / L·h > vDO = -0.10 mg / L·h (Note the negative value comparison logic, |-0.077| < |-0.10| indicates that the rate of decrease has not exceeded the threshold). The judgment condition is not met, and no trend warning is triggered, but the record "DO shows a downward trend and needs continuous monitoring" is recorded. In summary, the results of this sudden change trend warning judgment are: 2 sudden change trend warnings (COD and TN) are triggered, 1 is close to the warning threshold (NH3-N), and 2 are under normal monitoring (TP and DO). The sudden change trend warning information of COD and TN is packaged and output, forming a "threshold warning + trend warning" combined warning mode with the aforementioned red warning information (the severe warning triggered by the comprehensive warning index of 2.2698), and pushed to the emergency command platform. After receiving the combined warning, the emergency command personnel not only know that "the current water quality is seriously exceeding the standard and an immediate response is needed", but also know that "the water quality is rapidly deteriorating and the investigation efforts need to be strengthened and the response time shortened", which significantly improves the richness and guidance of decision-making information.

[0087] The fifth formula is used to establish a seasonal baseline value, as follows: ; Among them, C s (t) represents the seasonal baseline value at time t, K represents the number of years of historical backtracking, d represents the year offset index, and C(td*T) represents the seasonal baseline value at time t. y T represents the measured water quality value at the same time in the d-th year in history. y This represents the total time span of a year. The fifth formula is essentially an arithmetic average of historical data from the same period over many years. It extracts seasonal patterns through "horizontal comparison of longitudinal time series," filters out random components of interannual fluctuations, and retains long-term stable seasonal patterns.

[0088] Taking a monitoring section of a Yangtze River tributary as an example, the current time t is 08:00 on June 16, 202x, and the historical backtracking period K is set to 5 years. A time window matching strategy is adopted: monitoring data from June 15-17 of each year (3 days in total, one day before and one day after) are extracted, and the average value of the data within each year's window is taken as the representative value C(td×T) for the same period of that year. yThis approach ensures data comparability while enhancing robustness to missing values. The fifth formula is used to calculate the seasonal baseline value. Taking TP as an example, data from the same period over the past five years are extracted: 0.082 mg / L in 2023, 0.078 mg / L in 2022, 0.091 mg / L in 2021, 0.085 mg / L in 2020, and 0.088 mg / L in 2019. Substituting these values ​​into the formula yields CsTP(t) = (1 / 5) * 0.424 = 0.0848 mg / L. This value represents the historical normal level of TP concentration in mid-June. Compared to the current predicted value of 0.1958 mg / L, it exceeds the seasonal baseline by 2.31 times, suggesting an abnormal increase in TP load in the watershed. The same method was used to calculate the seasonal baseline values ​​for other indicators: COD was 16.8 mg / L (2.82 times the current 47.30 mg / L), TN was 1.288 mg / L (2.76 times the current 3.553 mg / L), NH3-N was 0.68 mg / L (2.79 times the current 1.899 mg / L), and DO was 7.2 mg / L (slightly lower than the current 6.643 mg / L by 7.7%). The seasonal baseline vector C was then obtained. s vec(t)=[16.8, 0.68, 0.0848, 1.288, 7.2]mg / L.

[0089] Simultaneously, the standard deviation σj of historical data for the same period is calculated to quantify the normal fluctuation range around the seasonal benchmark. Taking TP as an example, σTP = 0.00453 mg / L, indicating that under normal circumstances, TP should be within the range of 0.0848 ± 0.0045 mg / L. The standard deviations of other indicators are: σCOD = 0.96 mg / L, σNH3-N = 0.045 mg / L, σTN = 0.085 mg / L, and σDO = 0.22 mg / L, forming a standard deviation vector σvec = [0.96, 0.045, 0.00453, 0.085, 0.22] mg / L, which provides scale parameters for subsequent deviation standardization calculations.

[0090] The abnormal deviation of each water quality indicator is calculated item by item using the sixth formula, which is as follows: L(t)=|C(t)-C s (t)| / σ, where L(t) represents the abnormal deviation at time t, and C(t) represents the predicted value of the target water quality index in the comprehensive water quality index prediction value at the current time. s (t) represents the seasonal baseline value at time t, and σ represents the standard deviation of historical data for the same period. The sixth formula calculates the absolute deviation of the current forecast value from the seasonal baseline using the numerator, normalizes the denominator using the standard deviation, and outputs a dimensionless deviation factor.

[0091] Taking TP as an example, the calculation process is shown in detail: Current TP predicted value C TP(t) = 0.1958 mg / L, seasonal baseline C s TP(t) = 0.0848 mg / L, standard deviation σTP = 0.00453 mg / L. Substituting these values ​​into the sixth formula, we get LTP(t) = |0.1958 - 0.0848| / 0.00453 = 24.50. The physical meaning of this value is that the current predicted TP value deviates from the seasonal baseline by 24.50 times the historical standard fluctuation range. Under the assumption of a normal distribution, the probability density corresponding to 24.50 times the standard deviation is almost 0 (far exceeding the 3σ principle), indicating that the current TP concentration is abnormally high, a situation rarely seen in history, and there must be an abnormal pollution source input. Other indicators were calculated using the same method: LCOD(t) = |47.30-16.8| / 0.96 = 31.77, which is the most severely deviated among all indicators, strongly pointing to a major sudden organic pollution emission; LNH3-N(t) = |1.899-0.68| / 0.045 = 27.09, showing a highly significant abnormality in nitrogen pollution; LTN(t) = |3.553-1.288| / 0.085 = 26.65, comparable to NH3-N, reflecting the overall severity of nitrogen pollution; LDO(t) = |6.643-7.2| / 0.22 = 2.53, just exceeding the 2-standard-deviation threshold, in a critical state of abnormal deviation. The deviation vector Lvec(t) = [31.77, 27.09, 24.50, 26.65, 2.53] is obtained, providing a panoramic view of the deviation of each indicator from historical seasonal norms.

[0092] The abnormal deviation of each indicator was compared with the preset deviation threshold Lthreshold=2.0 to determine whether a periodic trend warning was triggered. The preset deviation threshold was selected in accordance with the statistical 2σ principle: under the assumption of normal distribution, 95% of the observed values ​​should fall within the mean ± 2σ range, and if they exceed this range, there is a 95% confidence level to consider it abnormal. The comparison results showed that all five indicators met the condition Lj(t)>Lthreshold: COD deviated by 31.77 times the standard deviation, triggering a highly significant abnormality warning; NH3-N deviated by 27.09 times the standard deviation, and the warning information showed that "the current value of 1.899 mg / L is 179% higher than the historical value of 0.68 mg / L in the same period, indicating a systematic increase in nitrogen load in the watershed, which may be related to long-term factors such as increased domestic sewage due to urbanization and increased agricultural fertilizer application intensity, and nitrogen pollution control strategies need to be formulated at the watershed scale"; TP deviated by 24.50 times the standard deviation, and the warning emphasized that "the current value of 0.1958 mg / L is 0.0 times the historical value in the same period." The concentration of nitrogen (TN) was 848 mg / L, an increase of 131%. Although it did not exceed the standard limit of 0.2 mg / L, it was significantly higher than the historical normal, indicating an accumulating risk of eutrophication. It is recommended to strengthen the control of agricultural non-point source pollution. The concentration of nitrogen (TN) deviated by 26.65 standard deviations, which is consistent with the NH3-N warning and points to a systemic deterioration of nitrogen pollution in the watershed. The concentration of nitrogen (DO) deviated by 2.53 standard deviations, and the risk level was set as "mildly abnormal (2-3σ)". The warning information was "the current value of 6.643 mg / L is slightly lower than the historical value of 7.2 mg / L for the same period, a decrease of 7.7%. This may be related to the increase in organic pollution load leading to the oxygen consumption rate exceeding the reoxygenation rate. Attention should be paid to the changing trend of the water body's self-purification capacity."

[0093] In summary, this early warning triggered five periodic trend warnings, four of which were highly significant anomalies (deviation > 24σ) and one was a significant anomaly (deviation 2-3σ). Combining these periodic trend warnings with red and abrupt trend warnings forms a three-dimensional early warning system: threshold warning + abrupt warning + periodic warning. Emergency commanders can obtain multi-level decision support through this three-dimensional system: red warnings indicate severe exceedances requiring immediate response; abrupt warnings indicate rapid water quality deterioration requiring intensified monitoring and source tracing; and periodic warnings indicate significant deviations from historical norms, representing rare extreme events requiring systematic investigation and long-term remediation. The core value of periodic trend warnings lies in revealing long-term, hidden environmental risk accumulation trends. Some pollution problems may not trigger alarms in the short term, but observations over annual or multi-year scales will reveal gradual water quality deterioration.

[0094] S106: In response to the early warning information, extract the hydrological sequence of the section exceeding the standard, determine the candidate pollution source set based on the coordinates of the sewage outlet, use hydrodynamics to perform time inversion on the hydrological sequence, and calculate the hydrodynamic confidence of each candidate pollution source.

[0095] In S106 above, after completing the early warning determination, it is necessary to conduct source tracing analysis on the pollution event that triggered the early warning in order to quickly locate the pollution source and support emergency response decisions. According to the design of the early warning classification, not all early warnings require immediate source tracing. When the early warning level reaches red (severe warning) or orange (moderate warning), the source tracing procedure is automatically triggered, while yellow (mild warning) only increases the monitoring frequency without initiating source tracing. The reason for this design is that a red warning represents a single indicator exceeding the standard limit by more than 2 times or the comprehensive pollution index is greater than 2.0, and an orange warning represents a single indicator exceeding the standard by 1-2 times or the comprehensive pollution index is between 1.5 and 2.0. In these two cases, the pollution has reached a severity level that requires immediate source investigation, and an emergency response must be initiated within 30 minutes to 2 hours. A yellow warning only indicates that the indicator is in the warning range of 80%-100% of the standard limit and has not yet formed a substantial exceedance. Initiating a full-process source tracing at this time would result in a waste of computing resources and unnecessary enforcement costs. In addition, when the mutation trend warning detects that the rate of change of an indicator exceeds the threshold (such as COD growth rate greater than 2 mg / L·h), the source tracing will be automatically triggered even if the red or orange warning threshold has not yet been reached. This is because a rapidly deteriorating trend often indicates that a sudden pollution event is taking place, and early source tracing can win a valuable window of time for emergency response.

[0096] In response to early warning information, the hydrological sequence of the exceeding section is extracted, and a set of candidate pollution sources is determined based on the coordinates of the sewage outlet. Hydrodynamics is used to perform time inversion on the hydrological sequence, and the hydrodynamic confidence level of each candidate pollution source is calculated. Specifically, this includes: identifying the exceeding section from the target watershed based on the early warning information, and obtaining the spatial location and trigger time of the exceeding section; extracting the hydrological sequence of the exceeding section within a preset historical period before the trigger time of the exceeding section, the hydrological sequence including at least the measured water level, river cross-sectional geometric parameters, and river slope; using the Manning formula to calculate the measured water level, river cross-sectional geometric parameters, and river slope to obtain the cross-sectional average velocity of the exceeding section; and using the Fisher longitudinal discretization formula to analyze the cross-sectional average velocity, river width, average water depth, and shear velocity in the river cross-sectional geometric parameters. The longitudinal dispersion coefficient of the river channel where the exceeding section is located is obtained through calculation. Based on the coordinates of the discharge outlets of each candidate pollution source, the spatial distance between each candidate pollution source and the exceeding section is calculated. The spatial distance is divided by the average flow velocity of the section to obtain the theoretical propagation time corresponding to each candidate pollution source. The theoretical emission time corresponding to each candidate pollution source is obtained by subtracting the exceeding trigger time from the theoretical propagation time. Based on the theoretical propagation time, longitudinal dispersion coefficient, and comprehensive attenuation coefficient, the exceeding concentration of the exceeding section is calculated by time inversion to obtain the theoretical emission concentration of each candidate pollution source at the theoretical emission time. The historical actual emission records of each candidate pollution source before and after the theoretical emission time are obtained. The matching degree between the theoretical emission concentration and the historical actual emission records is calculated to obtain the hydrodynamic confidence of each candidate pollution source.

[0097] Specifically, it is first necessary to extract the hydrological sequence of the cross-section exceeding the standard within a preset historical period before the triggering time of the exceedance, so as to carry out subsequent hydrodynamic reverse tracing calculations. Based on the spatiotemporal scale characteristics of watershed pollution diffusion, the preset historical period is set to 72 hours. This is because for medium-sized watersheds, it usually takes several hours to several days for pollutants discharged from upstream to reach the downstream monitoring section through the river channel. The 72-hour backtracking window can cover most pollution transmission scenarios, so that the real pollution source will not be missed due to the window being too short, nor will too much historical noise data be introduced due to the window being too long. The complete hydrological sequence of section SEC-202x-005 from 15:45 on May 9, 202x to 15:45 on May 12, 202x was retrieved from the hydrological database. This hydrological sequence contains the following key elements: measured water level sequence (one observation per hour, a total of 72 data points), geometric parameters of the river section (including the river width B=45 meters, average water depth h=3.28 meters, wetted perimeter P=51.56 meters, hydraulic radius R=h×B / (B+2h)=2.86 meters, and riverbed roughness n=0.030), and river slope S=0.0002 (calculated by dividing the elevation difference between upstream and downstream water level stations by the river length). The acquisition of these parameters relies on the previously established digital elevation model (DEM) of the watershed and the measured database of river cross sections. The riverbed roughness n is determined by looking up tables based on the riverbed type (gravel riverbed) and vegetation cover (no aquatic plants).

[0098] After obtaining the complete hydrological sequence, the average flow velocity at the sections exceeding the standard is calculated. This is a key parameter for subsequent back-calculation of pollutant propagation time. The flow velocity is calculated using the classic Manning formula, which is based on the theory of uniform flow in open channels and is applicable to velocity estimation in natural rivers. The mathematical expression of the Manning formula is u=(1 / n)*R (2 / 3) *S (1 / 2) Where u is the average flow velocity across the cross section (m / s), n is the riverbed roughness coefficient, R is the hydraulic radius (m), and S is the river channel slope. Substituting the parameters from the above embodiment into the formula: u = (1 / 0.030) * 2.86 (2 / 3) *0.0002 (1 / 2) =0.95 m / s. This calculation result indicates that, under the current hydrological conditions, the average flow velocity at the cross-section exceeding the standard is approximately 0.95 m / s, which translates to approximately 3.42 km / h, falling within the moderate flow velocity range. It should be noted that, because river flow velocity fluctuates with water level changes, the Manning formula was actually applied to the hourly water level data for each hour within the 72-hour historical period, resulting in a time-varying velocity sequence {u(t1), u(t2), ..., u(t... 72When calculating the subsequent pollutant propagation time, the average flow velocity ū = 0.95 m / s during this period is used as the representative value. This approach takes into account the time-varying characteristics of the flow velocity and avoids overly complex calculations of unsteady flow.

[0099] After obtaining the average flow velocity at the cross-section, the longitudinal dispersion coefficient of the river channel where the exceeding section is located is further calculated. This is a core parameter in the hydrodynamic convection-diffusion equation describing the lateral mixing and longitudinal dispersion of pollutants. The magnitude of the longitudinal dispersion coefficient directly affects the spatial distribution pattern and decay rate of pollutant concentration, and is crucial for the accuracy of source tracing calculations. The Fischer longitudinal dispersion formula is used for calculation. This formula is an empirical formula derived from statistical regression of a large amount of measured data from natural river channels, and has good universality. The mathematical expression of the Fischer formula is D=0.011*(u²×B² / (h×u0)), where D is the longitudinal dispersion coefficient (m² / s), u is the average flow velocity at the cross-section (m / s), B is the channel width (m), h is the average water depth (m), and u0 is the shear velocity (m / s). The shear velocity u0 can be calculated by u0=√(g×R×S), where g is the gravitational acceleration 9.8m / s². Substituting the parameters of this embodiment: u0 = √(9.8 × 2.86 × 0.0002) = 0.075 m / s, the longitudinal dispersion coefficient D is calculated as D = 0.011 * (0.95² × 45² / (3.28 × 0.075)) = 81.4 m² / s. This result indicates that under the current river channel conditions, the longitudinal diffusion rate of pollutants is relatively fast, which is consistent with the physical characteristics of moderate flow velocity and relatively wide river channels.

[0100] After completing the hydrological parameter calculations, a set of candidate pollution sources was determined, which is the target of the source tracing analysis. Information on all registered sewage outlets within the upstream watershed of the exceeding section was extracted from the dynamic electronic ledger database. The extraction criteria were: the sewage outlet's spatial location was upstream of the exceeding section (determined through GIS spatial analysis), and the sewage outlet type was point source emission (including industrial enterprise sewage outlets, urban sewage treatment plant sewage outlets, combined sewer overflow outlets, etc.; agricultural non-point source pollution was not considered). After screening, 23 candidate pollution sources meeting the criteria were identified in the upstream watershed. Each pollution source has complete spatial coordinate information (using the same CGCS2000 coordinate system as the exceeding section), sewage outlet number, sewage unit name, permitted emission volume, historical emission records, and other basic information in the ledger. For ease of subsequent calculations, these 23 candidate pollution sources were grouped into a set {S1, S2, ..., S...}. 23 Furthermore, an independent source tracing calculation thread is established for each pollution source to achieve parallel processing and improve computational efficiency.

[0101] For each candidate pollution source, the spatial distance between the candidate pollution source and the section exceeding the standard is first calculated, which is the basis for estimating the pollutant propagation time. The spatial distance calculation cannot simply use the straight-line distance between two points, but must consider the actual flow path of the river, because the transport of pollutants in the river strictly follows the water flow path. A flow path distance algorithm based on river network vector data is adopted: first, the complete river segment path from the discharge outlet of the candidate pollution source to the section exceeding the standard is extracted from the GIS river network layer, and then the measured lengths of each river segment are accumulated to obtain the flow path distance. Taking candidate pollution source S1 as an example (this pollution source is "discharge outlet of XX Chemical Industrial Park", number PO-2023-017, coordinates are 118.7623°E, 32.0856°N), the flow path distance from S1 to section SEC-2024-005 is obtained by river network topology analysis as L1 = 12.8 km. For other candidate pollution sources, the flow path distance vectors {L1=12.8km, L2=8.5km, L3=18.2km, ...,L} were also calculated. 23 =25.6km}, the shortest flow path distance is S2 (sewage discharge outlet of a town's sewage treatment plant) at 8.5 kilometers, and the farthest is S 23 (Sewage outlet of a food processing plant) 25.6 kilometers.

[0102] Based on the flow path distance and the average flow velocity at the cross-section, the theoretical propagation time of each candidate pollution source is calculated, i.e., the time required for pollutants to travel from the discharge outlet to the downstream cross-section exceeding the standard. The formula for calculating the theoretical propagation time is Δti = Li / A, where Δti is the theoretical propagation time (hours) of candidate pollution source Si, Li is the flow path distance (meters), and A is the average flow velocity (m / s). Taking S1 as an example: Δt1 = 12800m / (0.95m / s) = 13473 seconds ≈ 3 hours and 44 minutes. This calculation shows that if S1 discharges pollutants exceeding the standard at a certain moment, the pollutants will reach the SEC-2024-005 cross-section after 3 hours and 44 minutes. Similarly, the theoretical propagation time vectors of all candidate pollution sources are calculated {Δt1 = 3.74h, Δt2 = 2.49h, Δt3 = 5.32h, ..., Δt 23 =7.49h}. It should be noted that the theoretical propagation time here is a simplified estimate based on the average flow velocity. In reality, the migration speed of pollutants in the river channel is affected by factors such as dispersion and stagnant water areas, resulting in a certain degree of dispersion in the arrival time of the pollution plume.

[0103] By subtracting the trigger time of exceeding the standard from the theoretical propagation time, the theoretical emission time corresponding to each candidate pollution source is deduced. The calculation logic for the theoretical emission time is as follows: if a pollution source emits pollutants at the theoretical emission time *temit*, after the theoretical propagation time *Δti*, it will reach the downstream section and be detected exactly at the trigger time of exceeding the standard *talert* = 15:45 on 202x-05-12. Therefore, the theoretical emission time *temit* = *talert* - *Δti*. Taking S1 as an example: *temit,1* = 15:45 on 2024-05-12 minus 3 hours and 44 minutes = 12:01 on 2024-05-12. This deduction result indicates that if the COD pollutant exceeding the standard detected at section SEC-2024-005 at 15:45 did indeed originate from the S1 discharge outlet, then this discharge outlet most likely experienced the behavior of exceeding the standard around 12:01 on the same day. The same time-backtracking was performed on all candidate pollution sources to obtain the theoretical emission time vector {temit,1=12:01, temit,2=13:16, temit,3=10:29, ...,temit,23=08:12}, which covers the range of 8 hours before the trigger time of exceeding the standard. This is consistent with the aforementioned 72-hour hydrological sequence extraction window.

[0104] After obtaining the theoretical emission times of each candidate pollution source, the system needs to perform time-reversal calculations on the excess concentrations at the cross-sections exceeding the standards. This calculations estimate the required emission concentrations of each candidate pollution source at the theoretical emission times to produce the observed excess concentrations at the downstream cross-sections after river transport and attenuation. This inversion calculation is based on the analytical solution of the one-dimensional convection-diffusion equation. The mathematical expression of the convection-diffusion equation is: ∂C / ∂t + u*∂C / ∂x = D*∂t / ∂x. 2 C / ∂x 2 -kC+S, where C is the pollutant concentration (mg / L), t is time (s), x is the spatial coordinate along the river channel (m), u is the flow velocity (m / s), D is the longitudinal dispersion coefficient (m² / s), k is the comprehensive attenuation coefficient (1 / s), and S is the source term (mg / L·s). For the simplified scenario of instantaneous point source emissions, this equation has a Green's function analytical solution, expressed as: ; Where M is the total emission (kg) and b is the cross-sectional area (m²). 2), where C is the pollutant concentration (mg / L), t is the time (s), x is the spatial coordinate along the river channel (m), u is the flow velocity (m / s), D is the longitudinal dispersion coefficient (m² / s), and k is the comprehensive attenuation coefficient (1 / s). However, in actual traceability scenarios, pollution sources are often continuously discharged rather than instantaneously discharged, and parameters such as river cross-section area and flow velocity vary along the course, making the strict solution of the partial differential equation extremely complex. Therefore, the system uses a simplified concentration attenuation formula for inversion: Cemit=Calert*exp(k*Δti)*f(D, Δti), where Cemit is the theoretical discharge concentration (mg / L) of the candidate pollution source at the theoretical discharge moment, Calert is the exceeding-standard concentration (mg / L) observed at the exceeding-standard section, k is the comprehensive attenuation coefficient (1 / d), Δti is the theoretical propagation time (d), and f(D, Δti) is the concentration attenuation correction factor considering the dispersion effect.

[0105] The comprehensive attenuation coefficient k is a parameter that describes the concentration attenuation caused by the combined effects of biodegradation, chemical oxidation, sedimentation and adsorption during the transport of pollutants in the river channel. The magnitude of the k value depends on many factors such as pollutant type, water temperature, dissolved oxygen, and river sediment, and needs to be determined through tracer experiments or historical data regression. Piecewise calibrated k values are adopted for different hydrological periods: in the dry season (flow Q<Qper20, that is, the flow is less than the 20% quantile), k=0.15 / d; in the normal season (Qper20≤Q≤Qper80), k=0.20 / d; in the flood season (Q>Qper80), k=0.25 / d. In this embodiment, the watershed flow at the exceeding-standard trigger moment is 125 m³ / s, and historical flow statistics show that Qper20=80 m³ / s and Qper80=180 m³ / s, so it is determined that the current period is the normal season, and k=0.20 / d is adopted. The dispersion correction factor f(D, Δti) is used to correct the effects of pollution plume broadening and peak concentration reduction caused by longitudinal dispersion. Theoretically, the f value should be calculated according to the dispersion number Pe=u×L / D, but in engineering applications, to simplify the calculation, the empirical formula f=1+0.1*√(D×Δti) is adopted, which has good applicability under the condition that the dispersion number Pe>10 (advection dominated).

[0106] Taking S1 as an example, the specific calculation is as follows: the observed COD concentration at the exceeding section is Calert = 186 mg / L, the theoretical propagation time is Δt1 = 3.74 h = 0.156 d, the comprehensive attenuation coefficient is k = 0.20 / d, the longitudinal dispersion coefficient is D = 81.4 m² / s = 7033 m² / d, and the dispersion correction factor is f = 1 + 0.1 * √(7033 * 0.156) = 4.31. Substituting into the concentration inversion formula: (Cemit,1) = 186 * exp(0.20 * 0.156) * 4.31 = 827 mg / L. This calculation indicates that if the observed COD concentration of 186 mg / L at the exceeding section does indeed originate from the S1 discharge outlet, then the discharge concentration at the theoretical discharge time (12:01) of S1 must reach approximately 827 mg / L. After 3.74 hours of river transport, the pollutant concentration decreases by 3.2% due to biodegradation and is reduced to 23% (1 / 4.31) of its original concentration due to diffusion dilution, ultimately reaching a concentration of 186 mg / L at the downstream section. The system performed the same concentration inversion calculation on all 23 candidate pollution sources, obtaining the theoretical discharge concentration vector {Cemit,1=827 mg / L, Cemit,2=1052 mg / L, Cemit,3=658 mg / L, ..., Cemit,23=542 mg / L}. Due to differences in flow path distance and propagation time, the theoretical discharge concentrations obtained from different pollution sources vary significantly. The greater the distance and the longer the propagation time, the more significant the attenuation and diffusion effects, and the higher the inverted theoretical discharge concentration.

[0107] After completing the concentration inversion, it is necessary to calculate the matching degree between the theoretical emission concentration of each candidate pollution source and its historical actual emission records to assess the probability that the pollution source actually emitted the corresponding concentration of pollutants at the theoretical emission time, thereby quantifying the hydrodynamic confidence level. Historical actual emission records of each candidate pollution source before and after the theoretical emission time are extracted from the dynamic electronic ledger of "one source, one file". The time window is set to ±1 hour before and after the theoretical emission time (2 hours in total). This is because the theoretical propagation time calculation is based on the average flow velocity and has a certain error; setting a time tolerance window can improve the robustness of the matching. Taking S1 as an example, the online monitoring data of S1 from 11:01 to 13:01 on May 12, 202x was extracted. The sewage outlet is equipped with a COD online monitoring instrument, and the data upload frequency is once every 15 minutes. A total of 8 data points were obtained: {11:01-285mg / L, 11:16-302mg / L, 11:31-318mg / L, 11:46-345mg / L, 12:01-812mg / L, 12:16-798mg / L, 12:31-623mg / L, 12:46-487mg / L}. The monitoring data clearly shows that the measured COD concentration at the S1 discharge outlet at 12:01 was 812 mg / L, which is highly consistent with the theoretical discharge concentration of 827 mg / L obtained from the aforementioned hydrodynamic inversion. The relative error is only (827-812) / 827*100%=1.8%. This extremely high degree of matching strongly suggests that S1 is likely the real source of this pollution incident.

[0108] The matching score is calculated using the standardized relative error formula: (Shydro,i)=1-|(Cemit,i)-(Cactual,i)| / Cemit,i, where (Cactual,i) is the maximum measured concentration of the candidate pollution source within a ±1 hour window before and after the theoretical emission time (the maximum value is taken to capture possible instantaneous peak emissions). Taking S1 as an example: (Shydro,1)=1-|827-812| / 827=0.982. To map the score to a confidence interval of 0-1 and consider the impact of time alignment accuracy, a time alignment correction factor (αtime,i)=exp(-|(tactual,i)-(temit,i)| / 1h) is further introduced, where (tactual,i) is the time corresponding to the maximum measured concentration, and (temit,i) is the theoretical emission time. For S1, the measured peak of 812 mg / L occurs at 12:01, which is completely consistent with the theoretical emission time, therefore (αtime,1)=exp(0)=1.0. The final hydrodynamic confidence level is (Chydro,i)=(Shydro,i)*(αtime,i). For S1, it is (Chydro,1)=0.982*1.0=0.982, which is a hydrodynamic confidence level of 98.2%, belonging to the very high confidence level.

[0109] The same matching degree calculation was performed on other candidate pollution sources, and the results showed that the hydrodynamic confidence of most pollution sources was low. For example, although S2 (the discharge outlet of a sewage treatment plant in a certain town) is relatively close to the section exceeding the standard (8.5km), its measured COD concentration before and after the theoretical discharge time (13:16) was only 35-42mg / L, which is far lower than the theoretical discharge concentration of 1052mg / L obtained by inversion. The matching degree score (Shydro,2)=1-|1052-42| / 1052=0.04, and the hydrodynamic confidence degree is only 4%, which basically excludes the possibility of it being a pollution source. For example, although the theoretical emission concentration of S3 (a dyeing and printing factory's discharge outlet) is 658 mg / L, which is comparable to its historical emission level, the measured concentration before and after the theoretical emission time (10:29) is only 180-210 mg / L, with a matching score of 0.68. Furthermore, the measured peak occurs at 10:45, a deviation of 16 minutes from the theoretical emission time. The time alignment correction factor (αtime,3) = exp(-16 / 60) = 0.77. The final hydrodynamic confidence score is (Chydro,3) = 0.68 * 0.77 = 0.52, which is considered a medium confidence level. Summarizing the hydrodynamic confidence score calculation results for 23 candidate pollution sources, sorted from highest to lowest confidence: {S1 - 98.2%, S...} 17 -76.5%, S3-52.1%, S8-38.7%, ..., S2-4.0%}, the top three candidate sources are S1, S2, S3, S4, S5, S6, S7, S8, S8, S9, S1, S8, S9, S1, S8, S9, S1, S9, S1, S9, S1, S1, S2 ...2, S1, S 17 The hydrodynamic confidence levels of both S3 and S3 exceed 50%, and they will proceed to the next stage of spectral fingerprint comparison and verification.

[0110] S107: Obtain the measured spectral characteristics of the water body at the section exceeding the standard, calculate the measured spectral characteristics of the water body and the spectral characteristics of each candidate pollution source, and obtain the spectral confidence level of each candidate pollution source.

[0111] In step S107 above, the measured spectral characteristics of the water body at the exceeding section are obtained. The measured spectral characteristics of the water body and the spectral characteristics of each candidate pollution source are calculated to obtain the spectral confidence level of each candidate pollution source. Specifically, this includes: obtaining hyperspectral remote sensing data of the water body at the exceeding section at the trigger time of the exceeding, extracting the remote sensing reflectance of multiple characteristic bands within a preset band range, and constructing the measured spectral fingerprint vector of the exceeding section; obtaining the historical spectral fingerprint vector corresponding to each candidate pollution source from a preset spectral fingerprint database, wherein the historical spectral fingerprint vector is generated by the corresponding candidate pollution source... The historical remote sensing reflectance of pollution sources under the same characteristic bands is used to construct the data. The dot product between the measured spectral fingerprint vector and the historical spectral fingerprint vector of each candidate pollution source is calculated. The magnitude of the vector is obtained by multiplying the magnitude of the measured spectral fingerprint vector by the magnitude of each historical spectral fingerprint vector. The spectral similarity of each candidate pollution source is obtained by dividing the dot product by the magnitude of the vector. The inverse cosine function is used to calculate the spectral angular distance of each candidate pollution source. The spectral confidence of each candidate pollution source is determined based on the spectral similarity and spectral angular distance of each candidate pollution source.

[0112] Specifically, when a monitoring section is detected to exceed the standard, hyperspectral remote sensing data of that section at the moment the exceedance was triggered needs to be acquired. The revisit cycle of hyperspectral satellites is typically 1-3 days. If no satellite passes overhead at the moment the exceedance occurs, the most recent valid image data from the time of the exceedance will be automatically retrieved, with the time difference usually controlled within 24 hours. The corresponding hyperspectral image files are automatically downloaded from the remote sensing data service platform. These files are stored in the ENVI standard format and contain two parts: a header file (.hdr) and a data file (.dat). The header file records metadata information such as the number of bands, spatial resolution, and geographic coordinates of the image, while the data file contains the radiance values ​​of each pixel in different bands.

[0113] After acquiring the raw image, radiometric and atmospheric correction preprocessing are immediately initiated. Radiometric correction aims to eliminate systematic errors inherent in the sensor, converting the raw DN values ​​into apparent reflectance. This step is automated by retrieving radiometric calibration coefficients from the image metadata. Atmospheric correction removes the influence of atmospheric scattering and absorption on the true surface reflectance. The FLAASH atmospheric correction model is used, which requires input parameters such as atmospheric visibility, water vapor content, and aerosol optical thickness at the time of image acquisition. These parameters are automatically obtained through interfacing with meteorological data fusion middleware. The remote sensing reflectance Rrs obtained after atmospheric correction accurately reflects the intrinsic optical characteristics of the water body and is unaffected by changes in atmospheric conditions. After completing radiometric and atmospheric corrections, the location of the exceeding sections in the image is determined. Exceeding sections typically correspond to water quality monitoring stations. The CGCS2000 coordinate system latitude and longitude coordinates of these stations are extracted from the monitoring station database and then mapped to the row and column positions of the hyperspectral image using a geographic coordinate transformation algorithm. Considering that the monitoring stations represent the average water quality at the cross-sectional scale, instead of extracting spectral data from individual pixels, the spectral values ​​of all pixels within a 3x3 pixel window (corresponding to a water area of ​​approximately 30m x 30m in a 10m resolution image) centered on the station coordinates are extracted. The mean of these spectral values ​​is then calculated as the representative spectral feature of the cross-section. This spatial averaging process effectively reduces potential noise interference from individual pixels, improving the stability and representativeness of the spectral features.

[0114] When extracting spectral data, not all bands are used; instead, characteristic bands within a preset band range are selected. Hyperspectral sensors typically have more than 100 continuous bands, covering the visible to near-infrared spectral range of 400-900 nm, but not all bands are sensitive to water quality information. Based on water optics theory and extensive experimental verification, 32 characteristic bands that show significant responses to pollutant characteristics were selected. The selection of these bands follows these principles: 8 bands were selected in the 400-500 nm blue light band, as this range is sensitive to changes in dissolved organic matter and suspended solids concentrations; 6 bands were selected in the 500-200 nm green light band, which is a key region for chlorophyll a absorption valley and reflection peak; 10 bands were selected in the 200-700 nm red light band, which includes the strong absorption peak (665 nm) and fluorescence peak (685 nm) of chlorophyll a; and 8 bands were selected in the 700-900 nm near-infrared band, where reflectance is mainly affected by suspended solids scattering. The average reflectance values ​​of these 32 characteristic bands within a 3x3 window of the exceeding section are extracted from the atmospherically corrected remote sensing reflectance image. Arranged in ascending order of wavelength, they form a 32-dimensional column vector, which is the measured spectral fingerprint vector FPa = [Rrs(λ1), Rrs(λ2), ..., Rrs(λ...]. 32 )).

[0115] To achieve spectral fingerprint comparison, a spectral fingerprint database covering all known pollution sources within the watershed is pre-established. The construction of this database is a continuous process of accumulation and dynamic updating. In the initial stage of system deployment, technicians conduct baseline surveys of key discharge outlets within the watershed. Using drones equipped with hyperspectral cameras or historical satellite imagery, hyperspectral data of the waters near each discharge outlet is collected. After undergoing the same preprocessing steps as for the sections exceeding emission standards, reflectance data from 32 characteristic bands is extracted to construct the initial spectral fingerprint. As the system operates, whenever the source tracing system successfully identifies a pollution source, it automatically retrieves the spectral data of that emission event and performs a weighted fusion update with the historical spectral fingerprint of that pollution source. The specific update formula is FPnew = 0.9 * FPold + 0.1 * FPa. This weighted averaging strategy retains the core information of historical features while incorporating the changing characteristics of the latest observation data, enabling the spectral fingerprint to adapt to seasonal changes in pollution source emission characteristics and process adjustments. The spectral fingerprint of each pollution source is stored in the spectral fingerprint database in JSON format, containing fields such as pollution source ID, spectral fingerprint vector, last update time, and cumulative update count.

[0116] After obtaining the measured spectral fingerprint vector FPa of the cross-section exceeding the standard and the historical spectral fingerprint vectors FPi (i=1, 2, ..., n) of each candidate pollution source, it is necessary to quantitatively assess the degree of similarity between them. The calculation of spectral similarity cannot simply use Euclidean distance or Manhattan distance, because these measures are insensitive to the overall shape of the spectral curves and are easily affected by the absolute value of reflectance. The calculation of spectral similarity first requires calculating the vector inner product between the measured spectral fingerprint vector FPa and the historical spectral fingerprint vectors FPi of the candidate pollution sources. The geometric meaning of the vector inner product is the product of the projected lengths of the two vectors in the direction of the other. Traversing 32 characteristic bands, the reflectance value of the measured spectrum in each band is multiplied by the historical reflectance value of the candidate pollution source in the corresponding band, and then the 32 multiplications are summed. This inner product value reflects the directional consistency of the two spectral vectors; if the two spectral curves are highly similar in shape, the inner product value will be larger.

[0117] Calculate the magnitudes of the two spectral vectors. Geometrically, the magnitude of a vector represents its length; for a spectral fingerprint vector, it reflects the overall intensity level of spectral reflectance. The magnitude of the measured spectral fingerprint vector is calculated by summing the squares of the reflectances of each of the 32 bands and then taking the square root. Similarly, calculate the magnitude of the historical spectral fingerprint vector of the candidate pollution source. Multiply these two magnitudes to obtain the vector magnitude product. This product is used as a normalization factor to eliminate the influence of the absolute value of spectral reflectance. The final calculation of spectral similarity is achieved by dividing the vector inner product by the vector magnitude product, i.e., Simi = (FPa * FPi) / (||FPa|| * ||FPi||), where FPa represents the magnitude of the measured spectral fingerprint vector, and FPi represents the magnitude of the historical spectral fingerprint vector. This formula is mathematically equivalent to calculating the cosine of the angle between the two vectors; therefore, the value of spectral similarity ranges from -1 to 1. When Simi=1, it indicates that the two spectral vectors are completely parallel, have the same direction, and have identical spectral curve shapes. This means that the spectral characteristics of the water body exceeding the standard highly match the candidate pollution source. When Simi=0, it indicates that the two spectral vectors are orthogonal and have no correlation. When Simi=-1, it indicates that the two spectral vectors are in opposite directions. This situation almost never occurs in actual water quality remote sensing because remote sensing reflectance does not have negative values. The spectral similarity is calculated for each candidate pollution source within the watershed, forming a similarity ranking list.

[0118] To further improve the reliability and discriminative power of spectral comparison, spectral angular distance is introduced as a supplementary indicator based on similarity calculation. The physical meaning of spectral angular distance is the angle between two spectral vectors. It is calculated by applying an inverse cosine function to the spectral similarity, i.e., SADi = arccos(Simi). Since the cosine function monotonically decreases from 0 to π, spectral angular distance is negatively correlated with spectral similarity; the higher the similarity, the smaller the angular distance. The unit of spectral angular distance is radians, and its value ranges from 0 to π. When SADi is close to 0, it indicates that the angle between the two spectral vectors is very small, almost parallel, and their spectral characteristics are highly consistent. When SADi is close to π / 2 (approximately 1.57 radians), it indicates that the two spectral vectors are orthogonal, and their characteristics are significantly different.

[0119] Furthermore, after obtaining the spectral similarity and spectral angular distance of each candidate pollution source, the spectral confidence level corresponding to each candidate pollution source is determined based on the spectral similarity and spectral angular distance. Specifically, this includes: determining whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold and whether the corresponding spectral angular distance is less than a preset angular distance threshold, where the target candidate pollution source is any one of the candidate pollution sources; if the spectral similarity of the target candidate pollution source is greater than the first similarity threshold and the spectral angular distance of the target candidate pollution source is less than the preset angular distance threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a first matching state with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined to be a value within the first confidence level interval; if the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, then... The method determines whether the spectral similarity of the target candidate pollution source is greater than a second similarity threshold; wherein, the first similarity threshold is greater than the second similarity threshold; if the spectral similarity of the target candidate pollution source is greater than the second similarity threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a second matching state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the second confidence interval; if the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a mismatch state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the third confidence interval; wherein, the values ​​within the first confidence interval are all greater than the values ​​within the second confidence interval, and the values ​​within the second confidence interval are all greater than the values ​​within the third confidence interval.

[0120] Specifically, the spectral similarity and spectral angular distance of the target candidate pollution sources are obtained. The target candidate pollution source refers to a single pollution source object extracted sequentially from the set of candidate pollution sources. Each pollution source in the set is evaluated one by one. First, it is determined whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold and whether the corresponding spectral angular distance is less than a preset angular distance threshold. The first similarity threshold is determined through statistical analysis of multiple typical pollution events in a watershed, so it is set to 0.85. Since spectral angular distance is a complementary indicator to spectral similarity, when the first similarity threshold is set to 0.85, the preset angular distance threshold is set to 0.55 radians, forming a corresponding relationship with the first similarity threshold. If the spectral similarity of the target candidate pollution source is greater than the first similarity threshold and the corresponding spectral angular distance is less than the preset angular distance threshold, then the target candidate pollution source and the exceeding section are determined to be in a first matching state. The first matching state means that the measured spectral characteristics of the exceeding section are highly consistent with the historical spectral characteristics of the target candidate pollution source. This consistency reaches a level where the pollution source can be directly identified as the responsible source.

[0121] After confirming the first matching state, a corresponding spectral confidence score is assigned to the target candidate pollution source. This assignment process is not a simple matter of setting the confidence score to a fixed value, but rather a dynamic calculation based on the specific similarity value within the first confidence score interval. The first confidence score interval is defined as a numerical range between 0.85 and 1.00, with the lower bound of this interval consistent with the first similarity threshold to ensure logical consistency. A linear mapping strategy is used within the first confidence score interval, specifically calculated as (Cs, i) = Simi * 1.05, where Simi represents the spectral similarity, with an upper limit constraint not exceeding 1.0. This amplification factor of 1.05 reflects the confidence bonus when both similarity and angular distance conditions are met. Physically, when both the directional and angular consistency of the spectral features reach a high standard, the reliability of the source tracing results should receive an additional confidence bonus. For example, a wastewater discharge outlet in a chemical industrial park has a spectral similarity of 0.91 and a spectral angular distance of 0.42 radians, satisfying both conditions for the first matching state. The calculated spectral confidence level is 0.91 * 1.05 = 0.9555. Considering the upper limit constraint on confidence level, it is ultimately recorded as 0.96 or 96%. On the user interface, candidate pollution sources in the first matching state are presented with a special visual identifier. The pollution source icon is highlighted with a red border, placed first in the source tracing results list, and accompanied by the text label "High Match" and a red warning icon. This visual design aims to allow law enforcement officers to identify the most suspicious source of responsibility at a glance and immediately take on-site verification action. Simultaneously, a detailed source tracing report is automatically generated for this pollution source, including specific values ​​for spectral similarity and angular distance, historical spectral fingerprint comparison charts, historical warning records for the pollution source, and a comparison of permitted emissions with actual emissions.

[0122] When the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, it is determined whether the spectral similarity of the target candidate pollution source is greater than the second similarity threshold. The first similarity threshold is greater than the second similarity threshold. The second similarity threshold is determined through statistical analysis of historical cases, so it can be set to 0.70. When the spectral similarity of the target candidate pollution source is greater than the second similarity threshold, and the spectral similarity is less than or equal to the first similarity threshold, the target candidate pollution source and the exceeding section are determined to be in a second matching state. The second matching state means that the measured spectral characteristics of the exceeding section and the historical spectral characteristics of the target candidate pollution source are suspected to be a match. After confirming the second matching state, a spectral confidence score is assigned to the candidate pollution source in the second matching state. The second confidence score range is defined as a numerical range between 0.60 and 0.85. The upper bound of this range connects with the lower bound of the first confidence score range, ensuring the continuity and comparability of confidence scores between different matching states. No similarity value enhancement processing is performed; instead, the spectral similarity value is directly used as the spectral confidence score, i.e., (Cs,i)=Simi. This direct assignment method reflects a cautious approach to the second matching state, neither overestimating the suspicion level nor excessively lowering the investigation priority. For example, the spectral similarity of a sewage discharge outlet from a town's wastewater treatment plant is 0.78, and the spectral angular distance is 0.68 radians. Although the similarity reaches a certain level, the angular distance is too large and fails to simultaneously meet the dual conditions of the first matching state, thus classifying it as a second matching state. The spectral confidence level is directly set to 0.78 or 78%. On the user interface, candidate pollution sources in the second matching state are displayed in yellow and arranged after the red highly matching objects in the source tracing results list, forming a second-priority verification echelon. A "Suspected Match" text label and a yellow question mark icon are added next to the pollution source name. A special handling suggestion is added to the source tracing report: "The spectral characteristics of this pollution source have some similarity to the water body exceeding the standard, but the degree of matching does not reach the direct judgment standard. It is recommended to cross-validate with hydrodynamic source tracing results. If the conclusions of the two source tracing methods are consistent, the suspicion level of the pollution source can be increased; if the conclusions are inconsistent, on-site sampling and laboratory spectral analysis are required for further confirmation." When the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, the target candidate pollution source is determined to be in a mismatch state with the exceeding section. This mismatch state indicates that the emission spectral characteristics of the target candidate pollution source are fundamentally different from those of the exceeding water body, making it extremely unlikely to be the source of responsibility for this pollution incident. When the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold of 0.70, a mismatch state determination is performed. The matching status field of the target candidate pollution source is updated to "mismatch" in the database and it is classified as a low-priority category in the source tracing report. For candidate pollution sources in a mismatch state, a punitive attenuation strategy is used when assigning spectral confidence. The third confidence interval is defined as a numerical range between 0.30 and 0.60. The upper bound of this interval connects with the lower bound of the second confidence interval, maintaining the continuity of the confidence level. Spectral similarity is not directly used as the confidence level; instead, attenuation processing is performed, specifically calculated using the formula (Cs,i)=Simi*0.8. This attenuation coefficient of 0.8 reflects the degree of distrust in low-similarity matches. By artificially lowering the confidence value, the confidence gap between mismatched states and other matching states is further widened, making the exclusion decision clearer. For example, the spectral similarity of an agricultural non-source heat pump confluence point is 0.62, which is below the second similarity threshold, and it is judged as a mismatched state. The calculated spectral confidence is 0.62 * 0.8 = 0.496, approximately 50%.

[0123] To prevent data distortion due to excessively low spectral confidence in extreme cases, a lower limit constraint on spectral confidence is set. When the spectral confidence after attenuation calculation is below 0.30, it is forcibly set to 0.30, meaning the minimum spectral confidence for mismatched states remains at 30%. This lower limit design is based on the principle of uncertainty; even if the spectral features are completely mismatched, a 30% uncertainty space is retained. This is because there are many unknown factors in actual pollution source tracing, such as the spectral fingerprint database not yet including certain new pollution sources or old pollution sources with significantly changed emission characteristics; the water body exceeding the standard may have undergone complex biochemical transformation processes, and the spectral characteristics of pollutants may have changed significantly during propagation, resulting in large differences between downstream and upstream source spectra. Considering these uncertainties, retaining a minimum 30% confidence level avoids over-excluding a candidate pollution source and leaves room for subsequent manual verification and evidence supplementation. On the user interface, candidate pollution sources in a mismatched state are presented in gray and listed at the end of the source tracing results list, with their visual weight significantly weakened. Next to the name of the pollution source, a text label reading "Low Match" and a gray cross icon are added, along with a "Recommended Exclusion" note in the source tracing report. This visual design aims to allow law enforcement officers to quickly identify pollution sources that do not require priority, focusing their attention on highly matched and potentially matched sources. However, information on candidate pollution sources with mismatches is not completely hidden or deleted; instead, it is retained in the appendix of the source tracing report for technical personnel to review when needed. This design reflects the principles of system transparency and traceability.

[0124] S108: Weighted fusion of hydrodynamic confidence and spectral confidence is performed to obtain the comprehensive confidence of each candidate pollution source.

[0125] In step S108 above, after obtaining the hydrodynamic confidence score and spectral confidence score for each candidate pollution source, the hydrodynamic and spectral confidence scores are weighted and fused, i.e., a linear weighted average is used. The overall confidence score for each candidate pollution source = hydrodynamic confidence score * hydrodynamic weight + spectral confidence score * spectral weight, where the sum of the hydrodynamic weight and the spectral weight equals 1. This is to ensure that the fused overall confidence score remains within the standardized range of 0 to 1, facilitating comparison with a preset threshold. The numerical settings of the hydrodynamic and spectral weights reflect the degree of trust in different source tracing methods. When the hydrodynamic weight is close to 1, it indicates that the decision-maker trusts the hydrodynamic source tracing results more, and the overall confidence score is mainly determined by the hydrodynamic confidence score. When the hydrodynamic weight is close to 0, it indicates that the decision-maker trusts the spectral source tracing results more, and the overall confidence score is mainly determined by the spectral confidence score. When the hydrodynamic weight is 0.5, it indicates that the two source tracing methods are of equal status, and the overall confidence score is an equally weighted average of the two. Therefore, the hydrodynamic weight was set to 0.6, a value determined through statistical analysis of historical source tracing cases. After calculating the overall confidence level of a single candidate pollution source, similar calculations were performed for other candidate pollution sources to obtain the overall confidence level for each candidate pollution source.

[0126] S109: Identify candidate pollution sources with a comprehensive confidence level greater than a preset threshold as target pollution sources, automatically locate the target pollution outlet corresponding to the target candidate pollution source, and output the source tracing results based on the target pollution outlet.

[0127] In step S109 above, after calculating and ranking the overall confidence level of all candidate pollution sources, the target pollution sources that truly require enforcement verification are selected from the candidate pollution source set. This selection process cannot simply use the candidate source with the highest overall confidence level as the sole target pollution source, because actual pollution events may involve the combined effects of multiple pollution sources, or there may be multiple candidate sources with similar levels of suspicion requiring simultaneous verification. At the same time, not all candidate pollution sources can be treated as target pollution sources, as this would lead to a serious waste of enforcement resources and low enforcement efficiency. By setting a minimum threshold for overall confidence level, candidate pollution sources with a certain level of overall confidence level are selected as target pollution sources, realizing the transformation of the source tracing results from a candidate set to a confirmed target. The overall confidence level of each candidate pollution source is compared with the preset threshold. The setting of the preset threshold is a core parameter for determining the target pollution source, and its value directly affects the balance between the recall rate and precision rate of the source tracing system. Statistical analysis was performed on historical cases of 108 typical pollution events in a certain watershed over the past three years, and a curve showing the relationship between overall confidence level and source tracing accuracy was plotted. The analysis results show that when the preset threshold is set to 0.80, a reasonable recall rate can be achieved while maintaining a high precision rate. Therefore, the preset threshold is set to 0.80.

[0128] When the overall confidence level of a candidate pollution source exceeds a preset threshold, the suspicion level of that candidate pollution source is determined to have reached the level requiring law enforcement intervention. This candidate pollution source is then identified as a target pollution source and included in the source tracing results output. During the determination process, the list of candidate pollution sources after overall confidence level calculation and sorting is traversed, and each candidate source's overall confidence level is checked to ensure it exceeds the preset threshold. For candidate pollution sources that meet the criteria, a "Target Pollution Source" label is added to the data record, and the source tracing status field is updated to "Identified as Target Pollution Source." The determination timestamp and confidence level value are also recorded. For candidate pollution sources with an overall confidence level less than or equal to 0.80, the suspicion level is determined not to have reached the determination standard, and they are not temporarily listed as target pollution sources. However, their basic information is still retained in the appendix of the source tracing report for technical personnel to review when needed.

[0129] After identifying the target pollution source, the specific location of its corresponding discharge outlet is further determined. This is because a pollution source may have multiple discharge outlets, or there may be a spatial distance between the conceptual location of the pollution source and the actual physical discharge outlet. Accurate location of the target discharge outlet is a prerequisite for law enforcement officers to conduct on-site verification. If the discharge outlet location information is inaccurate or incomplete, law enforcement officers may be unable to locate the actual discharge point upon arrival, leading to inefficient verification work or even failure. A list of associated discharge outlets is maintained for each pollution source in the pollution source database. This list records information on all registered discharge outlets under the name of the pollution source, including the discharge outlet's unique identifier, name, type (e.g., industrial wastewater discharge outlet, domestic sewage discharge outlet, combined sewer overflow, etc.), spatial coordinates, relative position between the discharge outlet and the main body of the pollution source, designed discharge capacity, and monitoring equipment configuration. When a candidate pollution source is identified as the target pollution source, its unique identifier is immediately extracted from the pollution source database. Then, using this identifier as the index key, the discharge outlet ledger database is queried to retrieve all discharge outlet records whose associated fields equal the target pollution source identifier. For pollution sources with only a single discharge outlet, that outlet is directly identified as the target discharge outlet, and its spatial coordinates and detailed information are extracted. For pollution sources with multiple discharge outlets, further analysis is conducted to determine which outlet is most likely the emission point of this pollution event. First, a distance-first principle is applied: the distance between each discharge outlet and the river channel section exceeding the standard is calculated, and the nearest discharge outlet is selected as the primary target discharge outlet. Closer distance means shorter pollutant propagation time, which better matches the theoretical propagation time calculated by hydrodynamic source tracing. Second, a monitoring data-first principle is applied: each discharge outlet is checked for online monitoring equipment, and outlets with online monitoring data are prioritized as target discharge outlets, as this provides direct verification evidence for source tracing results. Third, a historical warning frequency principle is applied: the number of historical warnings for each discharge outlet is statistically analyzed, and outlets with higher warning frequencies are prioritized as target discharge outlets, as historical records indicate potentially unstable discharge behavior. Combining the scores from these three dimensions, a priority score is calculated for each discharge outlet, and the outlet with the highest score is selected as the primary target discharge outlet, while other discharge outlets are marked as secondary verification objects.

[0130] After identifying the target discharge outlet, its geographic coordinates are input into a GIS (Geographic Information System) for spatial visualization. The outlet's location is prominently displayed in red on the watershed's electronic map, using a flashing icon to attract the attention of law enforcement personnel. Clicking the outlet marker on the map opens a detailed information window displaying key information such as the outlet's name, number, pollution source, spatial coordinates, overall confidence level, theoretical discharge time, type and concentration of the pollutant exceeding the standard. The system also plots the pollution propagation path from the outlet to the exceeding section on the map, using blue arrows to indicate water flow direction and pollutant diffusion trajectory. The line thickness encodes the relative concentration of pollutants, and the theoretical arrival time of key nodes is marked on the lines, helping law enforcement personnel intuitively understand the spatiotemporal evolution of pollutants. A precise navigation and positioning package is also generated for the outlet, used by law enforcement personnel during on-site verification. This package includes the outlet's latitude and longitude coordinates, detailed address description, surrounding landmarks, on-site photos, and suggested optimal routes. The navigation and positioning package is encoded in the form of a QR code. Law enforcement officers can scan the QR code with a mobile app to directly activate the map navigation function and obtain the optimal driving or walking route from their current location to the target sewage outlet. For sewage outlets located in remote areas or areas with complex terrain, it also provides aerial views from drones and 3D terrain models to help law enforcement officers familiarize themselves with the surrounding environment before arriving at the scene, improving the efficiency and safety of the inspection work.

[0131] Once the target discharge outlet is located, the on-site monitoring equipment is automatically triggered to respond. If an AI video surveillance camera is deployed near the target discharge outlet, instructions are sent to the camera to adjust its shooting angle and focus, centering the discharge area of ​​the target outlet in the frame, and activating high-definition recording mode to continuously record the real-time discharge status of the target discharge outlet after the source is identified. These real-time video feeds are simultaneously pushed to the mobile terminals of law enforcement personnel and the large screen in the command center, allowing law enforcement personnel to remotely observe the current status of the target discharge outlet while en route to the scene and make a preliminary judgment on whether there is any obvious illegal discharge. If the video surveillance detects that the target discharge outlet is discharging large amounts of wastewater of abnormal color or has obvious overflow, an emergency prompt is added to the source tracing report: "Video surveillance has detected abnormal discharge; it is recommended to expedite the verification process," reminding law enforcement personnel to arrive at the scene as soon as possible to secure evidence.

[0132] After identifying the target pollution source and locating the target discharge outlet, all the results of the source tracing analysis are integrated into a structured source tracing report for output. This report is not simply a list of pollution source names and coordinates, but a comprehensive technical report containing multi-dimensional information including the tracing process, confidence assessment, chain of evidence, and verification recommendations. This source tracing report must meet the needs of technical personnel for in-depth analysis, accommodate the needs of law enforcement personnel for rapid decision-making, and adapt to different application scenarios such as reporting to higher-level authorities and delivering to polluting enterprises.

[0133] While outputting the source tracing results, the system automatically triggers the update of the dynamic electronic ledger for each discharge outlet. This electronic ledger is a digital archive system for all discharge outlets within the watershed, recording comprehensive information such as basic information, dynamic monitoring data, historical early warning records, enforcement inspection details, and risk level assessments for each outlet. Once a discharge outlet is identified as a target outlet by the source tracing system, its electronic ledger needs to be updated promptly, incorporating the source tracing results into the historical record. Furthermore, the risk level of the discharge outlet is dynamically adjusted based on the accumulated frequency of early warnings and violations, thus transforming discharge outlet management from static registration to dynamic assessment.

[0134] Based on the unique identifier of the target discharge outlet, the archive record of the discharge outlet is located from the electronic ledger database. First, the dynamic record fields in the ledger are updated, writing key information for this source tracing into the historical record, including the following field updates: the warning counts for the last 30 days and 90 days are automatically incremented by 1; the most recent warning time is updated to the current timestamp; the latest comprehensive confidence score is updated to the value for this source tracing; and the current status is dynamically determined based on the warning frequency as "first warning," "suspected abnormal emissions," or "high risk." The historical spectral fingerprint vector is updated using an exponentially weighted moving average strategy, and the risk score is recalculated. Based on the risk score, the discharge outlet is divided into three levels: high risk (>0.7), medium risk (0.4-0.7), and low risk (≤0.4), marked with red, orange, and green on the GIS map, respectively. After the ledger is updated, a JSON format change log is automatically generated, recording the update details for audit traceability.

[0135] After completing the source tracing results output and updating the electronic ledger, the automatic generation process of the disposal work order is immediately triggered. This transforms the source tracing results into specific enforcement tasks and assigns them to the responsible departments, resolving issues such as delayed information transmission, unclear responsibility division, and difficulty in tracking progress in traditional pollution disposal processes, thus achieving closed-loop management of pollution control. Work order generation is initiated based on the following conditions: a comprehensive confidence level > 0.80 and the target discharge outlet's status is "suspected abnormal emission" or "high risk"; triggering a red alert requires initiating an emergency response within 30 minutes; the same discharge outlet being locked for the second time within 7 days indicates suspected repeated violations. Otherwise, only a source tracing result report is output for reference. Work orders are automatically generated using a template, including the work order number (WS-Y ... Twenty-four hours after a work order is closed, an effectiveness evaluation loop is initiated. Water quality monitoring data is automatically retrieved to analyze trends before and after treatment, determining whether the treatment is "effective and pollution is under control" or "the treatment effect is poor, and stronger supervision is recommended." The latter automatically generates a review work order and feeds it back into the electronic ledger system. Discharge outlets with repeatedly unsuccessful treatments automatically have their risk level upgraded.

[0136] This application embodiment also provides an intelligent early warning and source tracing device for watershed water environment. The device includes a receiving unit, a processing unit, an early warning unit, and a source tracing unit. The receiving unit receives multi-source heterogeneous data collected from the target watershed. The processing unit aligns and extracts feature values ​​from the multi-source heterogeneous data to obtain a unified feature vector. The unified feature vector is then input into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model for processing to obtain multiple predicted values ​​of water quality indicators, with each predicted value corresponding to one model. The prediction error of each model within the historical backtracking window is obtained, and the target weight of each model at the current moment is calculated based on the prediction error. The early warning unit performs a weighted summation of the predicted water quality indicators output by each model and the corresponding target weight to obtain a comprehensive early warning result. The system integrates predicted water quality indicators and generates early warning information based on these predictions. The source tracing unit, responding to the early warning information, extracts the hydrological sequence of the exceeding sections and determines a set of candidate pollution sources based on the coordinates of the discharge outlets. It then uses hydrodynamics to perform time-reversal on the hydrological sequence and calculates the hydrodynamic confidence score for each candidate pollution source. The system acquires the measured spectral characteristics of the water body at the exceeding sections and calculates the spectral confidence score for each candidate pollution source by combining these characteristics with the spectral characteristics of each candidate pollution source. Finally, it performs a weighted fusion of the hydrodynamic and spectral confidence scores to obtain the comprehensive confidence score for each candidate pollution source. Candidate pollution sources with a comprehensive confidence score greater than a preset threshold are identified as target pollution sources. The system automatically locates the target pollution outlet corresponding to each target candidate pollution source and outputs the source tracing results based on the target pollution outlet.

[0137] In one possible implementation, the processing unit is used to obtain the predicted values ​​of each model at historical moments and the corresponding measured water quality index values ​​at historical moments from the historical backtracking window; calculate the predicted values ​​and measured water quality index values ​​using a first formula to obtain the prediction error corresponding to each model; calculate the reciprocal of each prediction error and normalize each prediction error using a second formula to obtain the initial weight of each model at the current moment; obtain rainfall data, river hydrological data, and upstream reservoir data from multi-source heterogeneous data; determine the hydrological period of the target watershed at the current moment based on the rainfall data, river hydrological data, and upstream reservoir data; match the corresponding hydrological correction factor based on the hydrological period; correct the correction factor and the initial weight of each model using a third formula, and normalize the corrected weights to obtain the target weight of each model at the current moment.

[0138] In one possible implementation, the first formula is as follows: ; Among them, E i Y(t) represents the prediction error of the model at time t, and Y0(tj) represents the measured water quality index value at the historical time tj; i(tj) represents the model's predicted value at historical time tj; N represents the length of the historical backtracking window; i represents the model index, and i∈{preset water quality mechanism model, preset machine learning model, preset deep learning model}; j represents the offset index of the historical time; the second formula is as follows: ; Among them, w i (t) represents the initial weights of the model at time t, and satisfies α represents the preset sensitivity coefficient, M represents the total number of models participating in the integration, k represents the loop index variable for model summation, and E k (t) represents the prediction error of model k at time t; the third formula is as follows: ; Among them, W i (t) represents the target weight of the model at time t, βi represents the hydrological correction factor for model i corresponding to the current hydrological period, k represents the circular index variable for model summation, and w k (t) represents the initial weights of the model at time t, β k The model k represents the hydrological correction factor corresponding to the current hydrological period, and M represents the total number of models participating in the integration.

[0139] In one possible implementation, the early warning unit is used to divide the predicted value of each water quality indicator in the comprehensive water quality indicator prediction value by the corresponding preset standard limit value to obtain the standardized index of each water quality indicator; to calculate the comprehensive early warning index by weighted summation of each standardized index using preset indicator weights; to compare the comprehensive early warning index with a first early warning threshold, a second early warning threshold, and a third early warning threshold, wherein the first early warning threshold is greater than the second early warning threshold, and the second early warning threshold is greater than the third early warning threshold; if the comprehensive early warning index is greater than or equal to the first early warning threshold, a severe early warning information is generated; if the comprehensive early warning index is less than the first early warning threshold but greater than or equal to the second early warning threshold, a moderate early warning information is generated; if the comprehensive early warning index is less than the second early warning threshold but greater than or equal to the third early warning threshold, a mild early warning information is generated.

[0140] In one possible implementation, the source tracing unit is used to determine the exceeding cross-sections from the target watershed based on early warning information, and to obtain the spatial location and trigger time of the exceeding cross-sections; extract the hydrological sequence of the exceeding cross-sections within a preset historical period before the trigger time of the exceeding cross-sections, the hydrological sequence including at least the measured water level, river cross-sectional geometric parameters, and river slope; calculate the average flow velocity of the exceeding cross-section using the Manning formula, the river cross-sectional geometric parameters, and the river slope; calculate the longitudinal dispersion coefficient of the river channel where the exceeding cross-section is located using the Fisher longitudinal dispersion formula, the river channel width, average water depth, and shear velocity in the river cross-sectional geometric parameters; and based on each candidate pollution source... The coordinates of the discharge outlets are determined, and the spatial distance between each candidate pollution source and the exceeding section is calculated. The spatial distance is divided by the average flow velocity of the section to obtain the theoretical propagation time for each candidate pollution source. The theoretical emission time for each candidate pollution source is then calculated by subtracting the exceeding trigger time from the theoretical propagation time. Based on the theoretical propagation time, longitudinal dispersion coefficient, and comprehensive attenuation coefficient, the exceeding concentration of the exceeding section is calculated using time inversion to obtain the theoretical emission concentration of each candidate pollution source at the theoretical emission time. Historical actual emission records of each candidate pollution source before and after the theoretical emission time are obtained, and the matching degree between the theoretical emission concentration and the historical actual emission records is calculated to obtain the hydrodynamic confidence level of each candidate pollution source.

[0141] In one possible implementation, the receiving unit is used to acquire hyperspectral remote sensing data of the water body at the time of triggering the exceedance of the standard section, extract the remote sensing reflectance of multiple characteristic bands within a preset band range, and construct the measured spectral fingerprint vector of the exceedance section; obtain the historical spectral fingerprint vector corresponding to each candidate pollution source from the preset spectral fingerprint database, wherein the historical spectral fingerprint vector is composed of the historical remote sensing reflectance of the corresponding candidate pollution source under the same characteristic band; the source tracing unit is used to calculate the vector dot product between the measured spectral fingerprint vector and the historical spectral fingerprint vector of each candidate pollution source, multiply the magnitude of the measured spectral fingerprint vector by the magnitude of each historical spectral fingerprint vector to obtain the vector magnitude; divide the vector dot product by the vector magnitude to obtain the spectral similarity of each candidate pollution source; calculate the spectral angular distance of each candidate pollution source by performing an inverse cosine function on each spectral similarity; and determine the spectral confidence level corresponding to each candidate pollution source based on the spectral similarity and spectral angular distance of each candidate pollution source.

[0142] In one possible implementation, the source tracing unit is used to determine whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold and whether the corresponding spectral angular distance is less than a preset angular distance threshold. The target candidate pollution source is any one of the candidate pollution sources. If the spectral similarity of the target candidate pollution source is greater than the first similarity threshold and the spectral angular distance of the target candidate pollution source is less than the preset angular distance threshold, then the measured spectral fingerprint of the exceeding section is determined to be in a first matching state with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined to be a value within the first confidence level interval. If the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, then it is determined whether the spectral similarity of the target candidate pollution source is greater than a second similarity threshold. The first similarity threshold is greater than the second similarity threshold. If the spectral similarity of the target candidate pollution source is greater than the second similarity threshold, the measured spectral fingerprint of the exceeding section is determined to be in a second matching state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the second confidence interval. If the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, the measured spectral fingerprint of the exceeding section is determined to be in a mismatch state with the target candidate pollution source, and the spectral confidence of the target candidate pollution source is determined to be a value within the third confidence interval. The values ​​within the first confidence interval are all greater than the values ​​within the second confidence interval, and the values ​​within the second confidence interval are all greater than the values ​​within the third confidence interval.

[0143] It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0144] This application also discloses an electronic device. (See reference...) Figure 2 , Figure 2 This application provides a schematic diagram of the structure of an electronic device. The electronic device 200 may include: at least one processor 201, at least one network interface 204, a user interface 203, a memory 202, and at least one communication bus 205.

[0145] The communication bus 205 is used to enable communication between these components.

[0146] The user interface 203 may include a display screen and a camera. Optionally, the user interface 203 may also include a standard wired interface and a wireless interface.

[0147] The network interface 204 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0148] The processor 201 may include one or more processing cores. The processor 201 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 202, and by calling data stored in memory 202. Optionally, the processor 201 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 201 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and application requests; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 201 and may be implemented as a separate chip.

[0149] The memory 202 may include random access memory (RAM) or read-only memory. Optionally, the memory 202 may include a non-transitory computer-readable storage medium. The memory 202 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 202 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 202 may also be at least one storage device located remotely from the aforementioned processor 201.

[0150] like Figure 2As shown, the memory 202, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application for intelligent early warning and tracing of the watershed's water environment.

[0151] exist Figure 2 In the electronic device 200 shown, the user interface 203 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 201 can be used to call the application program for intelligent early warning and source tracing of watershed water environment stored in the memory 202. When executed by one or more processors, the electronic device performs one or more of the methods described in the above embodiments.

[0152] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0153] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some service interfaces; indirect couplings or communication connections between devices or units may be electrical or other forms.

[0155] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0156] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0157] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0158] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and the disclosure of practical truths. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure.

Claims

1. A method for intelligent early warning and source tracing of watershed water environment, characterized in that, The method includes: Receive multi-source heterogeneous data collected from the target watershed; The multi-source heterogeneous data are aligned and feature values ​​are extracted to obtain a unified feature vector; The unified feature vector is input into a preset water quality mechanism model, a preset machine learning model and a preset deep learning model for processing to obtain multiple water quality index prediction values, with one water quality index prediction value corresponding to one model. Obtain the prediction error of each model within the historical backtracking window, and calculate the target weight of each model at the current time based on the prediction error; The predicted water quality index values ​​output by each model are weighted and summed with the corresponding target weights to obtain the comprehensive water quality index prediction value, and early warning information is generated based on the comprehensive water quality index prediction value. In response to the warning information, the hydrological sequence of the section exceeding the standard is extracted, and the set of candidate pollution sources is determined based on the coordinates of the sewage outlet. The hydrodynamics is used to perform time inversion on the hydrological sequence, and the hydrodynamic confidence of each candidate pollution source is calculated. The measured spectral characteristics of the water body at the section exceeding the standard are obtained, and the measured spectral characteristics of the water body and the spectral characteristics of each candidate pollution source are calculated to obtain the spectral confidence of each candidate pollution source. The hydrodynamic confidence score and the spectral confidence score are weighted and fused to obtain the comprehensive confidence score of each candidate pollution source; Candidate pollution sources with a comprehensive confidence level greater than a preset threshold are identified as target pollution sources. The target pollution outlet corresponding to the target candidate pollution source is automatically located, and the source tracing result is output based on the target pollution outlet.

2. The method according to claim 1, characterized in that, The step of obtaining the prediction errors of each model within the historical backtracking window and calculating the target weight of each model at the current time based on the prediction errors specifically includes: The predicted values ​​of each model at a historical moment are obtained from the historical backtracking window, as well as the corresponding measured water quality index values ​​at the historical moment. The predicted values ​​and the measured water quality index values ​​are calculated using the first formula to obtain the prediction error corresponding to each model. The reciprocal of each prediction error is calculated, and the prediction error is normalized using the second formula to obtain the initial weights of each model at the current time. Rainfall data, river hydrological data, and upstream reservoir data are obtained from the multi-source heterogeneous data. The hydrological period of the target watershed at the current moment is determined based on the rainfall data, the river hydrological data, and the upstream reservoir data, and the corresponding hydrological correction factor is matched based on the hydrological period; The third formula is used to correct the correction factor and the initial weights of each model, and the corrected weights are normalized to obtain the target weights of each model at the current time.

3. The method according to claim 2, characterized in that, The first formula is as follows: ; Among them, E i Y(t) represents the prediction error of the model at time t, and Y0(tj) represents the measured water quality index value at historical time tj; i (tj) represents the predicted value of the model at historical time tj; N represents the length of the historical backtracking window; i represents the model index, and i∈{preset water quality mechanism model, preset machine learning model, preset deep learning model}; j represents the offset index of the historical time. The second formula is as follows: ; Among them, w i (t) represents the initial weights of the model at time t, and satisfies α represents the preset sensitivity coefficient, M represents the total number of models participating in the integration, k represents the loop index variable for model summation, and E k (t) represents the prediction error of model k at time t; The third formula is as follows: ; Among them, W i (t) represents the target weight of the model at time t, βi represents the hydrological correction factor for model i corresponding to the current hydrological period, k represents the cyclic index variable for model summation, and w k (t) represents the initial weights of the model at time t, β k The model k represents the hydrological correction factor corresponding to the current hydrological period, and M represents the total number of models participating in the integration.

4. The method according to claim 1, characterized in that, The step of generating early warning information based on the predicted comprehensive water quality indicators specifically includes: The predicted values ​​of each water quality index in the comprehensive water quality index prediction value are divided by the corresponding preset standard limit value to obtain the standardized index of each water quality index. The comprehensive early warning index is calculated by weighting and summing the standardized indices using preset index weights. The comprehensive early warning index is compared with a first early warning threshold, a second early warning threshold, and a third early warning threshold, wherein the first early warning threshold is greater than the second early warning threshold, and the second early warning threshold is greater than the third early warning threshold. If the comprehensive early warning index is greater than or equal to the first early warning threshold, a severe early warning message is generated; If the comprehensive early warning index is less than the first early warning threshold and greater than or equal to the second early warning threshold, then a medium early warning message is generated; If the comprehensive early warning index is less than the second early warning threshold and greater than or equal to the third early warning threshold, a mild early warning message is generated.

5. The method according to claim 1, characterized in that, In response to the early warning information, the hydrological sequence of the section exceeding the standard is extracted, and a set of candidate pollution sources is determined based on the coordinates of the sewage outlet. Hydrodynamics is used to perform time inversion on the hydrological sequence to calculate the hydrodynamic confidence level of each candidate pollution source, specifically including: Based on the warning information, the section exceeding the standard is determined from the target watershed, and the spatial location and the time of triggering the exceeding standard are obtained; Extract the hydrological sequence of the cross section exceeding the standard within a preset historical period before the time of the exceedance. The hydrological sequence includes at least the measured water level, the geometric parameters of the river cross section, and the river slope. The average flow velocity of the cross-section exceeding the standard is obtained by calculating the measured water level, the geometric parameters of the river cross-section, and the river slope using the Manning formula. The longitudinal dispersion coefficient of the river channel where the cross-section is located is obtained by calculating the average flow velocity of the cross-section, the channel width, average water depth and shear velocity in the geometric parameters of the river channel cross-section using Fisher's longitudinal dispersion formula. Based on the coordinates of the discharge outlets of each of the candidate pollution sources, calculate the spatial distance between each of the candidate pollution sources and the section exceeding the standard; Divide the spatial distance by the average flow velocity of the cross section to obtain the theoretical propagation time corresponding to each of the candidate pollution sources, and calculate the difference between the exceedance trigger time and the theoretical propagation time to inversely deduce the theoretical emission time corresponding to each of the candidate pollution sources. Based on the theoretical propagation time, the longitudinal dispersion coefficient, and the comprehensive attenuation coefficient, the excess concentration of the exceeding section is calculated by time inversion to obtain the theoretical emission concentration of each of the candidate pollution sources at the theoretical emission time. Obtain historical actual emission records of each candidate pollution source before and after the theoretical emission time, calculate the matching degree between the theoretical emission concentration and the historical actual emission records, and obtain the hydrodynamic confidence degree of each candidate pollution source.

6. The method according to claim 1, characterized in that, The process of obtaining the measured spectral characteristics of the water body at the section exceeding the standard, and calculating the spectral confidence level of each candidate pollution source by combining the measured spectral characteristics of the water body with the spectral characteristics of each candidate pollution source, specifically includes: Obtain the hyperspectral remote sensing data of the water body at the time of triggering the exceedance of the cross section, extract the remote sensing reflectance of multiple characteristic bands within a preset band range, and construct the measured spectral fingerprint vector of the cross section. The historical spectral fingerprint vectors corresponding to each candidate pollution source are obtained from the preset spectral fingerprint database, wherein the historical spectral fingerprint vectors are composed of the historical remote sensing reflectance of the corresponding candidate pollution source under the same characteristic band. Calculate the dot product between the measured spectral fingerprint vector and the historical spectral fingerprint vectors of each candidate pollution source, and multiply the magnitudes of the measured spectral fingerprint vector and each historical spectral fingerprint vector to obtain the vector magnitude. Divide the vector inner product by the vector magnitude to obtain the spectral similarity of each candidate pollution source; The spectral angular distance of each candidate pollution source is obtained by calculating the inverse cosine function on the spectral similarity of each source. The spectral confidence level of each candidate pollution source is determined based on the spectral similarity and spectral angular distance of each candidate pollution source.

7. The method according to claim 6, characterized in that, The step of determining the spectral confidence level of each candidate pollution source based on the spectral similarity and spectral angular distance of each candidate pollution source specifically includes: Determine whether the spectral similarity of the target candidate pollution source is greater than a first similarity threshold, and whether the corresponding spectral angular distance is less than a preset angular distance threshold, wherein the target candidate pollution source is any one of the candidate pollution sources; If the spectral similarity of the target candidate pollution source is greater than the first similarity threshold, and the spectral angular distance of the target candidate pollution source is less than the preset angular distance threshold, then the measured spectral fingerprint of the substandard section is determined to be in a first matching state with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined to be a value within the first confidence level interval. If the spectral similarity of the target candidate pollution source is less than or equal to the first similarity threshold, it is determined whether the spectral similarity of the target candidate pollution source is greater than the second similarity threshold; wherein, the first similarity threshold is greater than the second similarity threshold; If the spectral similarity of the target candidate pollution source is greater than the second similarity threshold, then the measured spectral fingerprint of the cross section exceeding the standard is determined to be in a second matching state with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined to be a value within the second confidence level interval; If the spectral similarity of the target candidate pollution source is less than or equal to the second similarity threshold, then it is determined that the measured spectral fingerprint of the exceeding section is mismatched with the target candidate pollution source, and the spectral confidence level corresponding to the target candidate pollution source is determined as a value within the third confidence interval; wherein, the values ​​within the first confidence interval are all greater than the values ​​within the second confidence interval, and the values ​​within the second confidence interval are all greater than the values ​​within the third confidence interval.

8. An intelligent early warning and source tracing device for watershed water environment, characterized in that, The device includes a receiving unit, a processing unit, an early warning unit, and a source tracing unit. The receiving unit receives multi-source heterogeneous data collected from the target watershed; The processing unit aligns and extracts feature values ​​from the multi-source heterogeneous data to obtain a unified feature vector. The unified feature vector is input into a preset water quality mechanism model, a preset machine learning model, and a preset deep learning model for processing to obtain multiple predicted values ​​of water quality indicators, with one predicted value of water quality indicator corresponding to one model; the prediction error of each model within the historical backtracking window is obtained, and the target weight of each model at the current time is calculated based on the prediction error; The early warning unit performs a weighted summation of the predicted water quality index values ​​output by each model with the corresponding target weights to obtain a comprehensive water quality index prediction value, and generates early warning information based on the comprehensive water quality index prediction value. The source tracing unit, in response to the early warning information, extracts the hydrological sequence of the exceeding section, determines a set of candidate pollution sources based on the coordinates of the discharge outlet, performs time inversion on the hydrological sequence using hydrodynamics, and calculates the hydrodynamic confidence score of each candidate pollution source; acquires the measured spectral characteristics of the water body at the exceeding section, calculates the spectral confidence score of each candidate pollution source by combining the measured spectral characteristics of the water body with the spectral characteristics of each candidate pollution source; and performs a weighted fusion of the hydrodynamic confidence score and the spectral confidence score to obtain the comprehensive confidence score of each candidate pollution source. Candidate pollution sources with a comprehensive confidence level greater than a preset threshold are identified as target pollution sources. The target pollution outlet corresponding to the target candidate pollution source is automatically located, and the source tracing result is output based on the target pollution outlet.

9. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-7.