Water quality prediction method based on multi-source data and graph attention long short-term memory network

By constructing a water quality prediction method based on multi-source data and graph attention long short-term memory network, the problems of insufficient cross-sectional spatial dependence and multi-source data fusion in existing technologies are solved, and more accurate water quality prediction is achieved.

CN121279596APending Publication Date: 2026-01-06HOHAI UNIV

Patent Information

Application Number
CN202511460472.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

Existing water quality monitoring methods cannot fully consider the spatial dependence between cross sections within a river basin, and rely excessively on historical data, resulting in insufficient extraction of spatiotemporal features and fusion of multi-source data, making it difficult to obtain accurate water quality prediction results.

Method used

A water quality prediction method based on multi-source data and graph attention long short-term memory network is adopted. By acquiring multi-source data of target monitoring sections, a river topology map is constructed. By using a dual-channel graph attention network module, a time series feature extraction module, and a prediction output module, the spatial and temporal features of the river are integrated to improve the prediction accuracy.

Benefits of technology

By fully considering the upstream and downstream relationships between monitoring sections within the river basin, the accuracy of water quality prediction results has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121279596A_ABST
    Figure CN121279596A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of water quality monitoring, and provides a water quality prediction method based on multi-source data and a graph attention long-short term memory network, and the method comprises the steps: obtaining the annual multi-source data of a target monitoring section, carrying out the preprocessing of the multi-source data, obtaining the to-be-detected data, and carrying out the detection of the to-be-detected data; and inputting the to-be-detected data into the trained water quality prediction model, and obtaining a water quality prediction result of a preset number of days. The water quality prediction model is trained based on multi-source sample data of a plurality of monitoring sections, a river channel topological graph structure and water quality label data, and the river channel topological graph structure is determined according to an upstream and downstream relationship of a target monitoring section in a target regional river network and is constructed based on a graph attention network and a long and short term memory network; comprising a two-channel graph attention network module, a time sequence feature extraction module and a prediction output module, the upstream and downstream relation of a monitoring section is fully considered, multi-source data are fused, spatial features and time features are fully acquired, and the accuracy of the obtained water quality prediction result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water quality monitoring technology, and in particular to a water quality prediction method based on multi-source data and graph attention long short-term memory networks. Background Technology

[0002] In river water quality management practices, water quality indicators serve as key parameters for measuring the health of aquatic ecosystems, and their concentrations directly affect the survival of aquatic organisms and the self-purification capacity of water bodies. Specifically, by monitoring river water quality indicators, predicting future trends of key water quality indicators, and issuing early warnings for potential pollution events, proactive management and prevention measures can be strengthened. Therefore, monitoring river water quality indicators and predicting key water quality indicators are crucial for maintaining and improving water environmental quality.

[0003] In existing technologies, traditional water quality monitoring methods employ fixed-point sampling and laboratory analysis, which suffers from low spatiotemporal resolution and poor real-time performance. In recent years, machine learning-based water quality prediction methods have gradually developed. For example, water quality prediction methods based on Long Short-Term Memory networks or Random Forests can perform time-series analysis, improving prediction accuracy to some extent.

[0004] However, existing technologies cannot fully consider the spatial dependencies between cross sections within a river basin, and rely excessively on historical water quality monitoring data. Furthermore, machine learning-based water quality prediction methods still have shortcomings in spatiotemporal feature extraction and multi-source data fusion, making it difficult to obtain relatively accurate water quality prediction results. Summary of the Invention

[0005] The embodiments of the present invention provide a water quality prediction method based on multi-source data and graph attention long short-term memory network, which can fully consider the upstream and downstream relationships between monitoring sections in the river basin, and at the same time integrate multi-source data of the river to fully obtain spatial and temporal features, thereby improving the accuracy of obtaining water quality prediction results.

[0006] To achieve the above objectives, embodiments of the present invention provide a water quality prediction method based on multi-source data and graph attention long short-term memory networks, comprising: Acquire multi-source data corresponding to the target monitoring section under the annual data; The multi-source data is preprocessed to obtain the data to be detected corresponding to the target monitoring section; The data to be detected is input into the trained water quality prediction model to obtain the water quality prediction results for the target monitoring section for a preset number of days. The water quality prediction model is trained on a sample training set, which includes: multi-source sample data corresponding to multiple monitoring sections, river topology map structure, and water quality label data; the river topology map structure is determined based on the upstream and downstream relationship of the target monitoring section in the river network within the target area; the water quality prediction model is constructed based on graph attention network and long short-term memory network, and includes: a dual-channel graph attention network module, a time series feature extraction module, and a prediction output module.

[0007] In one embodiment, the multi-source data includes: urban sewage discharge data, meteorological data, water quality data, and agricultural non-point source pollution discharge data. The preprocessing of the multi-source data to obtain the data to be detected corresponding to the target monitoring section includes: Impute missing values ​​in the water quality data for the given year; Based on the urban sewage discharge data corresponding to the year, obtain the target urban sewage discharge data corresponding to each month and day; Based on the agricultural non-point source pollution emission data corresponding to the year, obtain the target agricultural non-point source pollution emission data for each month and each day.

[0008] In one embodiment, imputing missing values ​​in the annual water quality data includes: The duration of consecutive missing values ​​in the water quality data for the statistical year; Determine whether the continuous duration is less than or equal to a preset duration. If so, fill in the missing values ​​within the continuous duration using linear interpolation. If not, fill in missing values ​​with 0 for consecutive durations.

[0009] In one embodiment, the urban wastewater discharge data includes: domestic wastewater discharge data, industrial wastewater discharge data, and stormwater and sewage discharge data. The step of obtaining the target urban wastewater discharge data for each month and day, based on the corresponding urban wastewater discharge data for the year, includes: Acquire the annual discharge data of domestic sewage, industrial wastewater, and rainwater and sewage in each year; Based on the annual discharge data of domestic sewage, the annual discharge data of industrial wastewater, and the annual discharge data of rainwater and sewage, obtain the target monthly discharge data of domestic sewage, the target monthly discharge data of industrial wastewater, and the target monthly discharge data of rainwater and sewage for each month; Based on the target monthly discharge data of domestic sewage, target monthly discharge data of industrial wastewater, and target monthly discharge data of rainwater and sewage, obtain the daily discharge data of target domestic sewage, target daily discharge data of target industrial wastewater, and target daily discharge data of rainwater and sewage.

[0010] In one embodiment, acquiring the domestic sewage discharge data, the industrial wastewater discharge data, and the stormwater discharge data for each year includes: Acquire the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater discharge data for each year, including the domestic sewage discharge data, the industrial wastewater discharge data, and the rainwater discharge data. The initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater and sewage discharge data are corrected to obtain the annual discharge data of domestic sewage, the annual discharge data of industrial wastewater, and the annual discharge data of rainwater and sewage.

[0011] In one embodiment, the agricultural non-point source pollution emission data includes: fertilizer application pollution emission data, livestock and poultry breeding pollution emission data, rural domestic pollution emission data, and farmland solid waste pollution emission data. The step of obtaining target agricultural non-point source pollution emission data for each month and day based on the annual agricultural non-point source pollution emission data includes: Obtain annual emission data for pollution from fertilizer application, livestock and poultry farming, rural domestic pollution, and farmland solid waste. Based on the annual emission data of pollution from fertilizer application sources, livestock and poultry breeding sources, rural domestic sources, and farmland solid waste sources, obtain the monthly emission data of pollution from the target fertilizer application sources, the target livestock and poultry breeding sources, the target rural domestic sources, and the target farmland solid waste sources. Based on the monthly emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source, daily emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source are obtained.

[0012] In one embodiment, the river topology structure is determined based on the upstream and downstream relationships of the target monitoring section within the river network of the target area, including: Identify multiple monitoring sections within the target area corresponding to the target monitoring section; The initial adjacency matrix is ​​determined based on the upstream and downstream relationships of each monitoring section in the river network; A weighted adjacency matrix is ​​generated based on the reciprocal of the distance between adjacent monitoring sections and the initial adjacency matrix to construct the river topology map structure.

[0013] In one embodiment, the data to be detected is input into a trained water quality prediction model to obtain water quality prediction results for a preset number of days corresponding to the target monitoring section, including: The data to be detected is input into a dual-channel graph attention network module, and the target space enhancement features are extracted through the dual-channel graph attention network module. The target spatial enhancement features are input into the time series feature extraction module, and the time series feature extraction module extracts the temporal dynamic features. The time-series dynamic features are input into the prediction output module, and the prediction output module predicts the water quality forecast results for a preset number of days.

[0014] In one embodiment, the dual-channel graph attention network module includes: a local graph attention network unit and a global graph attention network unit. The data to be detected is input into the dual-channel graph attention network module, and target space enhancement features are extracted through the dual-channel graph attention network module, including: Determine whether the confluence time of the target monitoring section is greater than the preset prediction step size. If so, extract the target spatial enhancement features through the local graph attention network unit. If not, target space enhancement features are extracted using global graph attention network units.

[0015] In one embodiment, the local graph attention network unit includes: multiple layers of local graph attention network, and the extraction of target space enhancement features through the local graph attention network unit includes: For each local graph attention network layer, the input features of the target monitoring section and the nodes corresponding to the adjacent upstream monitoring sections of the target monitoring section in the river topology are extracted, and the input features are weighted and aggregated according to the preset attention coefficients to obtain the initial spatial enhancement features. Multiple initial spatial enhancement features are aggregated in multiple layers to determine the target spatial enhancement features; The global graph attention network unit includes: multiple global graph attention network layers. The extraction of target space enhancement features through the global graph attention network unit includes: For the global-local graph attention network layer, the input features of the target monitoring section and the nodes corresponding to all upstream monitoring sections of the target monitoring section in the river topology graph structure are extracted, and the multiple input features are weighted and aggregated according to the preset attention coefficient to obtain the initial spatial enhancement features. Multiple initial spatial enhancement features are aggregated in multiple layers to determine the target spatial enhancement features; The preset attention coefficient is related to the confluence time of the target monitoring section.

[0016] The above technical solution has the following technical effects: Thus, the water quality prediction method based on multi-source data and graph attention long short-term memory network provided in this embodiment obtains multi-source data corresponding to the target monitoring section under the year, preprocesses the multi-source data to obtain the data to be detected corresponding to the target monitoring section, and inputs the data to be detected into the trained water quality prediction model to obtain the water quality prediction result for the target monitoring section for a preset number of days. Since the water quality prediction model is trained based on multi-source sample data corresponding to multiple monitoring sections, river topology structure, and water quality label data, and the river topology structure is determined according to the upstream and downstream relationship of the target monitoring section in the river network of the target area, and the water quality prediction model is built based on graph attention network and long short-term memory network, including a dual-channel graph attention network module, a time series feature extraction module, and a prediction output module, it can fully consider the upstream and downstream relationship between monitoring sections in the river basin, and at the same time integrate the multi-source data of the river to fully obtain spatial and temporal features, thereby improving the accuracy of obtaining water quality prediction results. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating a water quality prediction method based on multi-source data and graph attention long short-term memory network provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of a river topology structure provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of experimental results provided in an embodiment of the present invention. Detailed Implementation

[0018] To further illustrate the various embodiments, the present invention provides accompanying drawings. These drawings are part of the disclosure of the present invention, primarily used to illustrate the embodiments and to explain the operating principles of the embodiments in conjunction with the relevant descriptions in the specification. With reference to these drawings, those skilled in the art should be able to understand other possible implementations and the advantages of the present invention. Components in the drawings are not drawn to scale, and similar component symbols are generally used to represent similar components.

[0019] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.

[0020] Example 1: Figure 1 This is a schematic flowchart of a water quality prediction method based on multi-source data and graph attention long short-term memory network according to an embodiment of the present invention. This embodiment specifically includes the following steps: S10: Obtain multi-source data corresponding to the target monitoring section under the year.

[0021] The multi-source data includes: urban sewage discharge data, meteorological data, water quality data, and agricultural non-point source pollution discharge data. Urban sewage discharge data includes: domestic sewage discharge data, industrial wastewater discharge data, and rainwater and sewage discharge data. Meteorological data includes: air temperature and precipitation. Water quality data includes: water temperature, pH, dissolved oxygen, permanganate index, ammonia nitrogen, total phosphorus, total nitrogen, turbidity, and conductivity. Agricultural non-point source pollution discharge data includes: fertilizer application pollution discharge data, livestock and poultry breeding pollution discharge data, rural domestic pollution discharge data, and farmland solid waste pollution discharge data. However, this invention is not limited to these sources and those skilled in the art can set the data according to the actual situation.

[0022] S11: Preprocess the multi-source data to obtain the data to be detected corresponding to the target monitoring section.

[0023] Specifically, after obtaining the multi-source data corresponding to the target monitoring section under the year, the multi-source data is preprocessed to obtain the data to be detected corresponding to the target monitoring section.

[0024] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S11 may be: S111: Impute missing values ​​in the annual water quality data.

[0025] Specifically, missing values ​​in annual water quality data are filled to eliminate the impact of short-term missing values.

[0026] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S111 may be: S1111: The duration of consecutive missing values ​​in water quality data for a given statistical year.

[0027] Specifically, for annual water quality data, the duration of consecutive missing values ​​is recorded.

[0028] S1112: Determine whether the continuous duration is less than or equal to the preset duration. If so, fill in the missing values ​​within the continuous duration using linear interpolation.

[0029] The preset duration is used to determine the set duration for how missing values ​​are filled. This duration can be, for example, 3 days, but is not limited thereto. This invention does not impose specific limitations, and those skilled in the art can set it according to the actual situation.

[0030] Specifically, the continuous duration is compared with the preset duration to determine whether the continuous duration is less than or equal to the preset duration. If the continuous duration is less than or equal to the preset duration, then the missing values ​​within the continuous duration are filled in using linear interpolation.

[0031] For example, if it is determined that missing values ​​begin to appear on day t, and there are no missing values ​​on the continuous duration of day t+2, i.e., the continuous duration is 1 day with a preset duration of 3 days, then according to the... Day t-1 and day t-1 Water quality data for day t+2 is used to fill in missing values ​​using linear interpolation. The linear interpolation formula can be defined by the following expression:

[0032] in, Indicates the first Water quality data for the day , Indicates the first Daily water quality data.

[0033] S1113: If not, fill in missing values ​​with 0 for consecutive durations.

[0034] Specifically, if the continuous duration exceeds the preset duration, missing values ​​within the continuous duration will be filled with zero values.

[0035] It should be noted that during the training of the water quality prediction model, water quality data filled with 0 values ​​are considered invalid data and are not included in the model training.

[0036] Optionally, after imputing missing values ​​in the water quality data, the imputed water quality data, urban sewage discharge data, meteorological data, and agricultural non-point source pollution discharge data can be standardized using a preset standardization formula.

[0037] The predefined standardized formula can be limited by the following expression:

[0038] in, This represents the mean values ​​corresponding to water quality data, urban sewage discharge data, meteorological data, and agricultural non-point source pollution discharge data, respectively. This represents the standard deviation of water quality data, urban sewage discharge data, meteorological data, and agricultural non-point source pollution discharge data, respectively. Indicates the first iAny one of the following: water quality data, urban sewage discharge data, meteorological data, and agricultural non-point source pollution discharge data.

[0039] S112: Based on the corresponding urban sewage discharge data for the year, obtain the target urban sewage discharge data for each month and day.

[0040] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S112 may be: S1121: Obtain data on domestic sewage discharge, industrial wastewater discharge, and rainwater discharge in the annual data on domestic sewage discharge, industrial wastewater discharge, and rainwater discharge.

[0041] Specifically, since urban sewage discharge data is the total amount of domestic sewage discharge data, industrial sewage discharge data, and stormwater discharge data, based on this, the annual discharge data for domestic sewage, industrial sewage, and stormwater discharge data for each year are obtained from the urban sewage discharge data.

[0042] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S1121 may be: S30: Obtain data on domestic sewage discharge, industrial wastewater discharge, and rainwater discharge in the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater discharge data for each year.

[0043] Specifically, based on the calculation formulas for domestic sewage discharge data, industrial wastewater discharge data, and rainwater discharge data, respectively, the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater discharge data are calculated.

[0044] The formula for calculating domestic sewage discharge data can be defined by the following expression:

[0045] in, This represents the initial domestic sewage discharge data at the target monitoring section. The first monitoring section of the target The total annual domestic water consumption of the administrative region corresponding to each upstream monitoring section. Indicates that it applies to the first The pollution reduction coefficient of domestic water in the administrative region corresponding to the upstream monitoring section can be determined according to the "Handbook of Pollution Generation and Discharge Coefficients of Domestic Pollution Sources" issued by the Ministry of Ecology and Environment of the People's Republic of China. For example, it is 0.8, but it is not limited thereto. This invention does not specifically limit it, and those skilled in the art can set it according to the actual situation.

[0046] The formula for calculating industrial wastewater discharge data can be defined by the following expression:

[0047] in, This represents the initial industrial wastewater discharge data for the target monitoring section. The first monitoring section of the target The total annual industrial water consumption of the administrative region corresponding to each upstream monitoring section. Indicates the first The industrial water reuse rate of the administrative region corresponding to each upstream monitoring section.

[0048] The formula for calculating stormwater and sewage discharge data can be defined by the following expression:

[0049]

[0050] in, This represents the initial stormwater and sewage discharge data. This indicates the total annual wastewater discharge. This indicates the proportion of students enrolled in the combined school system. Indicates the length of the combined sewer system. Indicates the total length of the drainage pipe network. Indicates the rainwater mixing coefficient. This indicates the percentage of rainfall during the rainy season.

[0051] S31: Correct the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater and sewage discharge data to obtain annual domestic sewage discharge data, annual industrial wastewater discharge data, and annual rainwater and sewage discharge data.

[0052] Specifically, by using the correction formulas corresponding to the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater discharge data, the initial domestic sewage discharge data, initial industrial wastewater discharge data, and initial rainwater discharge data are corrected to obtain annual domestic sewage discharge data, annual industrial wastewater discharge data, and annual rainwater discharge data.

[0053] The correction formula can be defined by the following expression:

[0054] in, This represents annual urban wastewater discharge data. This represents the corrected annual discharge data for domestic sewage. This represents the corrected annual industrial wastewater discharge data. This indicates the corrected annual emissions data for rainwater and sewage.

[0055] S1122: Based on the annual discharge data of domestic sewage, industrial wastewater, and rainwater and sewage, obtain the target monthly discharge data of domestic sewage, industrial wastewater, and rainwater and sewage for each month.

[0056] Specifically, using the annual discharge data of domestic sewage, industrial wastewater, and rainwater, respectively, the monthly discharge data of domestic sewage, industrial wastewater, and rainwater are calculated using the corresponding formulas.

[0057] The formula for calculating monthly domestic sewage discharge data can be defined by the following expression:

[0058] in, Indicates the current number m The average monthly temperature of the month, Indicates the average annual temperature. , These represent the maximum and minimum monthly average temperatures throughout the year, respectively. This represents a preset seasonality amplitude parameter, which can be, for example, 0.2. However, it is not limited to this; the present invention is not specifically limited, and those skilled in the art can set it according to actual conditions.

[0059] The formula for calculating monthly industrial wastewater discharge data can be defined by the following expression:

[0060] in, Indicates the current number m The monthly target region's main industrial product output of the province Indicates the first The monthly target region includes the output of major industrial products in the provinces.

[0061] The formula for calculating monthly stormwater and sewage discharge data can be defined by the following expression:

[0062] in, Indicates the current number m Rainfall in the target area in the month, This refers to a set of rainy season months, for example, the rainy season is generally from June to September, but it is not limited to this. This invention is not specifically limited, and those skilled in the art can set it according to the actual situation.

[0063] S1123: Based on the target monthly discharge data of domestic sewage, the target monthly discharge data of industrial wastewater, and the target monthly discharge data of rainwater and sewage, obtain the daily discharge data of target domestic sewage, target industrial wastewater, and target daily discharge data of rainwater and sewage.

[0064] Specifically, based on the target monthly discharge data of domestic sewage, target monthly discharge data of industrial wastewater, and target monthly discharge data of rainwater and sewage, the daily target daily discharge data of domestic sewage, target daily discharge data of industrial wastewater, and target daily discharge data of rainwater and sewage are calculated using the daily discharge data calculation formulas for domestic sewage, industrial wastewater, and rainwater and sewage.

[0065] The formula for calculating daily discharge data of domestic sewage can be defined by the following expression:

[0066]

[0067] in, Indicates the current number m Monthly target data for domestic sewage discharge. Indicates the current number m Total number of days in a month Indicates the first d Daily allocation coefficient Indicates the first i Daily allocation coefficient Indicates the daily average temperature. Indicates the current number m The average monthly temperature of the month, , They represent the current number. m The maximum and minimum daily average temperatures of the month. This represents the diurnal scale amplitude parameter, which is generally set to 0.2, but is not limited thereto. This invention does not impose specific limitations, and those skilled in the art can set it according to the actual situation.

[0068] The formula for calculating daily industrial wastewater discharge data can be defined by the following expression:

[0069] in, Indicates the current number m Total number of days in a month This represents the smoothing coefficient, ranging from 0 to 1, and is used to control the intensity of the influence between adjacent months. Indicates day sequence number , Indicates the current number m The target monthly industrial wastewater discharge data This indicates the target monthly industrial wastewater discharge data for the next month. Indicates the total number of days in the next month. This represents the target monthly industrial wastewater discharge data for the previous month. This indicates the total number of days in the previous month.

[0070] The formula for calculating daily stormwater and sewage discharge data can be defined by the following expression:

[0071] in, Indicates the first Daily rainfall, Indicates the first Daily rainfall, This indicates the target monthly emissions of rainwater and sewage. S113: Based on the corresponding agricultural non-point source pollution emission data for the year, obtain the target agricultural non-point source pollution emission data for each month and day.

[0072] Optionally, based on the above embodiments, in some embodiments of the present invention, one implementation of S113 may be: S1131: Obtain annual emission data for pollution from fertilizer application, livestock and poultry farming, rural domestic pollution, and farmland solid waste.

[0073] Specifically, the annual agricultural non-point source pollution emission data includes the total annual emission data from fertilizer application, livestock and poultry breeding, rural domestic pollution, and farmland solid waste. Based on this, the annual emission data for each of these sources is calculated using the corresponding first, second, third, and fourth pollutant emission calculation formulas.

[0074] Optionally, the annual emission data for pollutants from fertilizer application sources include: total nitrogen pollution load emissions from fertilizer application sources and total phosphorus pollution load emissions from fertilizer application sources. Based on this, the formula for calculating the first pollutant emission can be defined by the following expression:

[0075]

[0076] in, This indicates the total nitrogen pollution load emissions from nitrogen fertilizer application sources. This indicates the total phosphorus pollution load emissions from fertilizer application sources. This indicates the amount of nitrogen fertilizer applied. This indicates the amount of phosphate fertilizer applied. This indicates the amount of compound fertilizer applied. This indicates the nitrogen fertilizer loss rate. This indicates the phosphate fertilizer loss rate. This indicates the percentage of nitrogen in compound fertilizer. This indicates the proportion of phosphorus in the compound fertilizer. For example, the nitrogen fertilizer loss rate is taken as 11.61%, the phosphorus fertilizer loss rate is taken as 5.88%, the nitrogen content in the compound fertilizer is 40%, and the phosphorus content in the compound fertilizer is 32%, but it is not limited to this. This invention is not specifically limited, and those skilled in the art can set it according to the actual situation.

[0077] Optionally, the annual emission data of pollution from livestock and poultry farming sources consists of the total nitrogen pollution load emission, the total phosphorus pollution load emission, and the chemical oxygen demand (COD) pollution load emission from livestock and poultry farming sources. The calculation formula for the second pollutant emission can be defined by the following expression:

[0078] in, This refers to any one of the following: total nitrogen pollution load emissions from livestock and poultry farming, total phosphorus pollution load emissions from livestock and poultry farming, and chemical oxygen demand (COD) pollution load emissions from livestock and poultry farming. Indicates the first Standard breeding stock of livestock and poultry Indicates the first Pollution production coefficient of breeding livestock and poultry Indicates the first Loss rate of pollutants from breeding livestock and poultry This indicates the number of different types of livestock and poultry.

[0079] Optionally, the annual emission data of rural domestic pollution sources consists of the total nitrogen pollution load emission, the total phosphorus pollution load emission, and the chemical oxygen demand (COD) pollution load emission from rural domestic sources. The calculation formula for the third pollutant emission can be defined by the following expression:

[0080] in, This refers to any one of the following: total nitrogen pollution load emissions from rural domestic sources, total phosphorus pollution load emissions from rural domestic sources, and chemical oxygen demand (COD) pollution load emissions from rural domestic sources. Indicates the number of rural residents. This represents the annual pollution discharge coefficient per person for the corresponding farming household.

[0081] Optionally, the annual emission data of agricultural solid waste sources consists of the total nitrogen pollution load emission, the total phosphorus pollution load emission, and the chemical oxygen demand (COD) pollution load emission from agricultural solid waste sources. The formula for calculating the fourth pollutant emission can be defined by the following expression:

[0082] in, This represents any one of the following: total nitrogen pollution load emissions from farmland solid waste sources, total phosphorus pollution load emissions from farmland solid waste sources, and chemical oxygen demand (COD) pollution load emissions from farmland solid waste sources. Indicates the first The yield of crops. Indicates the first The percentage of agricultural waste. Indicates the first Pollutant content coefficient of agricultural waste, Indicates the first Pollutant loss rate from agricultural waste This indicates the number of different types of crops.

[0083] S1132: Based on the annual emission data of pollution from fertilizer application sources, livestock and poultry breeding sources, rural domestic sources, and farmland solid waste sources, obtain the monthly emission data of pollution from the target fertilizer application sources, livestock and poultry breeding sources, rural domestic sources, and farmland solid waste sources.

[0084] Specifically, after calculating the annual emission data of pollution from fertilizer application sources, livestock and poultry breeding sources, rural domestic sources, and farmland solid waste sources, the monthly emission data of target fertilizer application sources, target livestock and poultry breeding sources, target rural domestic sources, and target farmland solid waste sources are obtained according to the calculation formula for monthly emission data of agricultural non-point source pollution.

[0085] Optionally, since annual emission data for fertilizer application pollution and annual emission data for farmland solid waste pollution are related to rainfall, the calculation formula for monthly agricultural non-point source pollution corresponding to these data can be defined by the following expression:

[0086]

[0087] in, This represents annual emission data for pollution from fertilizer application sources or annual emission data for solid waste from farmland sources. Indicates the first Monthly rainfall, Indicates the monthly distribution coefficient. This represents the fertilization amplification factor, with a value of 0.5. , This function indicates the month for fertilization; the value is 1 for fertilization months and 0 for non-fertilization months.

[0088] Optionally, the calculation formula for the monthly agricultural non-point source pollution emissions corresponding to the annual emission data of livestock and poultry breeding pollution and the annual emission data of rural domestic pollution can be limited by the following expression:

[0089] in, This indicates annual emission data for pollution from livestock and poultry farming sources or annual emission data for pollution from rural domestic sources.

[0090] S1133: Based on the monthly emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source, obtain the daily emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source.

[0091] Specifically, based on the monthly emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source, the daily emission data of pollution from the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source are calculated using the agricultural non-point source pollution daily emission data calculation formula.

[0092] Optionally, the formula for calculating daily emissions data of agricultural non-point source pollution can be limited by the following expression:

[0093]

[0094]

[0095] in, Indicates the daily allocation coefficient. Indicates the first Daily rainfall, Indicates the first Daily rainfall, Indicates the first The amplification factor of heavy rain on that day Indicates the first The number of days with a lag in daily rainfall. Indicates the influence coefficient. This represents the sum of monthly emission data for the target fertilizer application source, the target livestock and poultry breeding source, the target rural domestic source, and the target farmland solid waste source.

[0096] Alternatively, one way to determine the heavy rain amplification factor and the number of lag days could be:

[0097] S12: Input the data to be detected into the trained water quality prediction model to obtain the water quality prediction results for the target monitoring section for the preset number of days.

[0098] The water quality prediction results can be one or more of the following water quality data: water temperature, pH, dissolved oxygen, permanganate index, ammonia nitrogen, total phosphorus, total nitrogen, turbidity, and conductivity.

[0099] The water quality prediction model is trained based on a sample training set, which includes: multi-source sample data corresponding to multiple monitoring sections, river topology structure, and water quality label data.

[0100] The above-mentioned river topology structure is determined based on the upstream and downstream relationships of the target monitoring section in the river network within the target area.

[0101] Optionally, based on the above embodiments, such as Figure 2 As shown, the target area refers to the monitored area to which the target monitoring section belongs. The target area includes multiple monitoring sections, such as 15 monitoring sections. When constructing the river topology map structure, each monitoring section is determined as a node in the river topology map structure. It should be noted that the target monitoring section is any one of the multiple monitoring sections. Based on this, in some embodiments of the present invention, one way to construct the river topology map structure can be: S20: Identify multiple monitoring sections within the target area corresponding to the target monitoring section.

[0102] S21: Determine the initial adjacency matrix based on the upstream and downstream relationships of each monitoring section in the river network.

[0103] Specifically, multiple monitoring sections within the target area to which the target monitoring section belongs are identified, and the upstream and downstream relationships of each monitoring section in the river network are determined using Geographic Information System (GIS) hydrological analysis tools. Based on the upstream and downstream relationships of each monitoring section in the river network, an initial adjacency matrix is ​​constructed.

[0104] For example, for the initial adjacency matrix ,in, NThe total number of monitoring sections existing within the target area is, for example, 15. This refers to any one of the multiple monitoring sections. i There are adjacent monitoring sections j If the monitoring section is satisfied i For adjacent monitoring sections j The direct upstream monitoring section is then determined in the initial adjacency matrix. =1, otherwise, .

[0105] S22: Generate a weighted adjacency matrix based on the reciprocal of the distance between adjacent monitoring sections and the initial adjacency matrix to construct the river topology map structure.

[0106] The reciprocal of the distance between adjacent monitoring sections is used to determine the edge weights between adjacent nodes in the river topology structure. This method ensures that the influence of the upstream monitoring section on each monitoring section decreases with distance.

[0107] Specifically, the distance between adjacent monitoring sections is calculated, and a weighted adjacency matrix is ​​generated based on the reciprocal of the distance between adjacent monitoring sections and the initial adjacency matrix, thereby constructing the river topology map structure.

[0108] For example, for the initial adjacency matrix The weighted adjacency matrix can be defined by the following expression:

[0109] in, Indicates monitoring section i With adjacent monitoring sections j The distance between them.

[0110] The water quality prediction model is built on graph attention network and long short-term memory network. The water quality prediction model includes: a dual-channel graph attention network module, a time series feature extraction module, and a prediction output module.

[0111] Optionally, based on the above embodiments, in some embodiments of the present invention, S12 may be implemented as follows: S121: Input the data to be detected into the dual-channel graph attention network module, and extract the target space enhancement features through the dual-channel graph attention network module.

[0112] S122: Input the target space enhancement features into the time series feature extraction module, and extract the time series dynamic features through the time series feature extraction module.

[0113] S123: Input the time-series dynamic features into the prediction output module, and predict the water quality prediction results for a preset number of days through the prediction output module.

[0114] Specifically, the data to be detected is input into a dual-channel graph attention network module, which performs feature extraction to obtain target spatial enhancement features. After obtaining the target spatial enhancement features, these features are input into a time-series feature extraction module to extract the temporal dynamic features of the target spatial enhancement features. Finally, the temporal dynamic features are input into a prediction output module, which then predicts the water quality for a preset number of days.

[0115] Thus, the water quality prediction method based on multi-source data and graph attention long short-term memory network provided in this embodiment obtains multi-source data corresponding to the target monitoring section under the year, preprocesses the multi-source data to obtain the data to be detected corresponding to the target monitoring section, and inputs the data to be detected into the trained water quality prediction model to obtain the water quality prediction result for the target monitoring section for a preset number of days. Since the water quality prediction model is trained based on multi-source sample data corresponding to multiple monitoring sections, river topology structure, and water quality label data, and the river topology structure is determined according to the upstream and downstream relationship of the target monitoring section in the river network of the target area, and the water quality prediction model is built based on graph attention network and long short-term memory network, including a dual-channel graph attention network module, a time series feature extraction module, and a prediction output module, it can fully consider the upstream and downstream relationship between monitoring sections in the river basin, and at the same time integrate the multi-source data of the river to fully obtain spatial and temporal features, thereby improving the accuracy of obtaining water quality prediction results.

[0116] Optionally, based on the above embodiments, the dual-channel graph attention network module includes: a local graph attention network unit and a global graph attention network unit. Therefore, in some embodiments of the present invention, one implementation of S121 may be: S1211: Determine whether the confluence time of the target monitoring section is greater than the preset prediction step size. If so, extract the target spatial enhancement features through the local graph attention network unit.

[0117] S1212: If not, extract target space enhancement features through global graph attention network units.

[0118] The confluence time is determined based on adjacent monitoring sections with upstream and downstream relationships. One method for determining the confluence time is as follows:

[0119] in, This represents the average flow velocity between adjacent monitoring sections. This indicates the distance between adjacent monitoring sections.

[0120] It should be noted that the confluence time corresponding to multiple monitoring sections within the target area can be determined by constructing a confluence time matrix. Store its elements The definition can be qualified by the following expression:

[0121] Specifically, the convergence time of the target monitoring section is compared with the preset prediction step size. If the convergence time is greater than the preset prediction step size, target spatial enhancement features are extracted using a local graph attention network unit. Otherwise, target spatial enhancement features are extracted using a global graph attention network unit.

[0122] Optionally, based on the above embodiments, the local graph attention network unit includes: a multi-layer local graph attention network layer, and the global graph attention network unit includes: a multi-layer global graph attention network layer. In some embodiments of the present invention, one implementation of S1211-S1212 may be: For each local graph attention network layer, the input features of the target monitoring section and the nodes corresponding to the adjacent upstream monitoring sections in the river topology are extracted. Based on the preset attention coefficients, the multiple input features are weighted and aggregated to obtain the initial spatial enhancement features.

[0123] Multiple initial spatial enhancement features are aggregated in multiple layers to determine the target spatial enhancement features.

[0124] For the global-local graph attention network layer, the input features of the target monitoring section and the nodes corresponding to all upstream monitoring sections in the river topology are extracted. Based on the preset attention coefficients, multiple input features are weighted and aggregated to obtain the initial spatial enhancement features.

[0125] Multiple initial spatial enhancement features are aggregated in multiple layers to determine the target spatial enhancement features.

[0126] The preset attention coefficient is related to the convergence time of the target monitoring section. The preset attention coefficient can be defined by the following expression:

[0127] in, Indicates the node corresponding to the upstream monitoring section For the nodes corresponding to the downstream monitoring sections The preset attention coefficient, 、 These represent nodes in a graph attention network. i and nodes Input features, Indicates the node corresponding to the downstream monitoring section. The set of all upstream neighbor nodes, The weight matrix is ​​a learnable matrix used to perform a shared linear transformation on the input feature vector of each node, thereby improving the model's expressive power. This represents a learnable attention vector. The attenuation rate parameter is a learnable parameter that enables the water quality prediction model to adaptively adjust the attenuation rate of spatial influences. The longer the confluence time, the larger the negative value, which can exponentially reduce the preset attention coefficient.

[0128] Optionally, the initial spatial augmentation features can be limited by the following expression:

[0129] in, Indicates the node corresponding to the downstream monitoring section. Initial spatial augmentation features after attention feature extraction It is a non-linear activation function. Indicates the node corresponding to the downstream monitoring section. All upstream monitoring sections corresponding to nodes i Features after linear transformation.

[0130] Optionally, based on the above embodiments, in some embodiments of the present invention, to verify that the water quality prediction method based on multi-source data and graph attention long short-term memory network can improve the accuracy of obtaining water quality prediction results, the network parameters of the model are initialized, such as setting the initial learning rate to 0.001 and the batch size to 32. The initial water quality prediction model is trained using a sample training set, and the trained water quality prediction model is then validated using a validation set. The experimental results are referenced. Figure 3 It can be seen that the water quality prediction results of the river monitoring section obtained by the present invention for the next 6 days are close to the actual values, indicating that the present invention can improve the accuracy of obtaining water quality prediction results.

[0131] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.

Claims

1. A water quality prediction method based on multi-source data and graph attention long short-term memory network, characterized in that, The method comprises: acquiring multi-source data corresponding to a target monitoring section in a year; preprocessing the multi-source data to obtain to-be-detected data corresponding to the target monitoring section; inputting the to-be-detected data into a trained water quality prediction model to obtain a water quality prediction result of the target monitoring section for a preset number of days; wherein the water quality prediction model is trained based on a sample training set, the sample training set comprising: multi-source sample data corresponding to multiple monitoring sections, a river topology graph structure, and water quality label data; the river topology graph structure is determined according to an upstream and downstream relationship of the target monitoring section in a river network in a target region; the water quality prediction model is constructed based on a graph attention network and a long short-term memory network, and the water quality prediction model comprises: a double-channel graph attention network module, a time series feature extraction module, and a prediction output module.

2. The method of claim 1, wherein, The multi-source data comprises: urban sewage discharge data, meteorological data, water quality data, and agricultural non-point source pollution discharge data; and the preprocessing of the multi-source data to obtain to-be-detected data corresponding to the target monitoring section comprises: performing missing value filling on the water quality data in the year; acquiring target urban sewage discharge data corresponding to the urban sewage discharge data in each month and each day according to the urban sewage discharge data corresponding to the year; acquiring target agricultural non-point source pollution discharge data corresponding to the agricultural non-point source pollution discharge data in each month and each day according to the agricultural non-point source pollution discharge data corresponding to the year.

3. The method of claim 2, wherein, The missing value filling on the water quality data in the year comprises: counting a continuous duration of continuous missing values in the water quality data in the year; determining whether the continuous duration is less than or equal to a preset duration; if yes, filling the missing values in the continuous duration by a linear interpolation method; if no, performing 0 value filling on the missing values in the continuous duration.

4. The method of claim 2, wherein, The urban sewage discharge data comprises: domestic sewage discharge data, industrial sewage discharge data, and rainwater sewage discharge data; and the acquisition of target urban sewage discharge data corresponding to the urban sewage discharge data in each month and each day according to the urban sewage discharge data corresponding to the year comprises: acquiring domestic sewage annual discharge data, industrial sewage annual discharge data, and rainwater annual discharge data of the domestic sewage discharge data, the industrial sewage discharge data, and the rainwater sewage discharge data in each year; acquiring target domestic sewage monthly discharge data, target industrial sewage monthly discharge data, and target rainwater monthly discharge data of each month according to the domestic sewage annual discharge data, the industrial sewage annual discharge data, and the rainwater annual discharge data; acquiring target domestic sewage daily discharge data, target industrial sewage daily discharge data, and target rainwater daily discharge data of each day according to the target domestic sewage monthly discharge data, the target industrial sewage monthly discharge data, and the target rainwater monthly discharge data.

5. The method of claim 4, wherein, The acquisition of domestic sewage annual discharge data, industrial sewage annual discharge data, and rainwater annual discharge data of the domestic sewage discharge data, the industrial sewage discharge data, and the rainwater sewage discharge data in each year comprises: The initial domestic sewage discharge data, the initial industrial sewage discharge data, and the initial rainwater sewage discharge data are corrected to obtain the annual domestic sewage discharge data, the annual industrial sewage discharge data, and the annual rainwater sewage discharge data. The initial domestic sewage discharge data, the initial industrial sewage discharge data, and the initial rainwater sewage discharge data are corrected to obtain the annual domestic sewage discharge data, the annual industrial sewage discharge data, and the annual rainwater sewage discharge data.

6. The method of claim 2, wherein, The agricultural non-point source pollution discharge data includes fertilizer application source pollution discharge data, livestock and poultry breeding source pollution discharge data, rural life source pollution discharge data, and farmland solid waste source pollution discharge data. The annual fertilizer application source pollution discharge data, the annual livestock and poultry breeding source pollution discharge data, the annual rural life source pollution discharge data, and the annual farmland solid waste source pollution discharge data are obtained. The target fertilizer application source pollution monthly discharge data, the target livestock and poultry breeding source pollution monthly discharge data, the target rural life source pollution monthly discharge data, and the target farmland solid waste source pollution monthly discharge data are obtained according to the annual fertilizer application source pollution discharge data, the annual livestock and poultry breeding source pollution discharge data, the annual rural life source pollution discharge data, and the annual farmland solid waste source pollution discharge data. The target fertilizer application source pollution daily discharge data, the target livestock and poultry breeding source pollution daily discharge data, the target rural life source pollution daily discharge data, and the target farmland solid waste source pollution daily discharge data are obtained according to the target fertilizer application source pollution monthly discharge data, the target livestock and poultry breeding source pollution monthly discharge data, the target rural life source pollution monthly discharge data, and the target farmland solid waste source pollution monthly discharge data.

7. The method of claim 1, wherein, The riverway topology structure is determined according to the upstream and downstream relationships of the target monitoring section in the river network in the target region, and includes: A plurality of monitoring sections in the target region corresponding to the target monitoring section are determined. An initial adjacency matrix is determined according to the upstream and downstream relationships of each monitoring section in the river network. A weighted adjacency matrix is generated according to the reciprocal distances between adjacent monitoring sections in the plurality of monitoring sections and the initial adjacency matrix to construct the riverway topology structure.

8. The method of claim 1, wherein, The to-be-detected data is input into the trained water quality prediction model to obtain the water quality prediction result of the preset number of days corresponding to the target monitoring section, including: The to-be-detected data is input into the double-channel graph attention network module to extract target spatial enhancement features through the double-channel graph attention network module. The target spatial enhancement features are input into the time series feature extraction module to extract time series dynamic features through the time series feature extraction module. The time series dynamic features are input into the prediction output module to predict the water quality prediction result of the preset number of days through the prediction output module.

9. The method of claim 8, wherein, The double-channel graph attention network module comprises a local graph attention network unit and a global graph attention network unit, the to-be-detected data is input into the double-channel graph attention network module, target spatial enhancement features are extracted through the double-channel graph attention network module, and the method comprises the following steps: It is judged whether the confluence time of the target monitoring section is greater than a preset prediction step, if yes, the target spatial enhancement features are extracted through the local graph attention network unit; If not, the target spatial enhancement features are extracted through the global graph attention network unit.

10. The method of claim 9, wherein, The local graph attention network unit comprises a plurality of local graph attention network layers, the target spatial enhancement features are extracted through the local graph attention network unit, and the method comprises the following steps: For each local graph attention network layer, input features of the target monitoring section and nodes corresponding to adjacent upstream monitoring sections of the target monitoring section in the river topological graph structure are extracted, a plurality of input features are weighted and aggregated according to a preset attention coefficient, and initial spatial enhancement features are obtained; A plurality of initial spatial enhancement features are subjected to multilayer aggregation processing to determine the target spatial enhancement features; The global graph attention network unit comprises a plurality of global graph attention network layers, the target spatial enhancement features are extracted through the global graph attention network unit, and the method comprises the following steps: For each global local graph attention network layer, input features of the target monitoring section and nodes corresponding to all upstream monitoring sections of the target monitoring section in the river topological graph structure are extracted, a plurality of input features are weighted and aggregated according to a preset attention coefficient, and initial spatial enhancement features are obtained; A plurality of initial spatial enhancement features are subjected to multilayer aggregation processing to determine the target spatial enhancement features; The preset attention coefficient is related to the confluence time of the target monitoring section.

Citation Information

Patent Citations

  • Pedestrian trajectory prediction method based on topological graph structure and deep self-attention network

    CN115082896A

  • Space-time multi-source offshore water quality time sequence prediction method of LSTM coupling mechanism model

    CN116187210A

  • Water quality prediction method based on multi-source data

    CN119598124A

  • Water quality and water quantity accurate simulation method and system based on SWAT model and storage medium

    CN119783371A

  • Basin hydrological multivariable prediction method based on meta-learning TFT architecture

    CN119848789A

Cited By

  • Mechanism data dual-driven flood forecasting method and system

    CN121980246A