A short-term water quality prediction method and system based on multi-feature training and meteorological correction

By employing multi-feature training and meteorological correction methods, a neural network prediction model was constructed and combined with land type adjustment. This solved the problems of adaptability and accuracy of water quality prediction models under extreme meteorological conditions, and achieved more accurate prediction of water quality change trends.

CN120508773BActive Publication Date: 2026-06-09CHINA NAT ENVIRONMENTAL MONITORING CENT

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA NAT ENVIRONMENTAL MONITORING CENT
Filing Date
2025-05-08
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing water quality prediction models suffer from low prediction accuracy and high uncertainty under extreme weather conditions due to their reliance on single features, insufficient exploration of nonlinear relationships, poor model adaptability, and lack of dynamic correction mechanisms.

Method used

By employing a multi-feature training and meteorological correction method, a neural network prediction model is constructed by collecting water quality parameters and meteorological data. Combined with land type adjustment, the prediction results are dynamically corrected to improve the model's adaptability and accuracy.

Benefits of technology

It significantly improves the accuracy and stability of water quality forecasting, especially under special meteorological conditions such as extreme rainfall, reducing forecast uncertainty and providing more accurate predictions of water quality change trends.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508773B_ABST
    Figure CN120508773B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of water quality detection and prediction, in particular to a short-term water quality prediction method and system based on multi-feature training and meteorological correction. The method comprises the following steps: collecting water quality parameter data and meteorological prediction data; preprocessing the collected water quality parameter data in a monitoring period; inputting the collected meteorological prediction data and the preprocessed water quality parameter data into a pre-trained water quality index prediction model for prediction; adjusting the model prediction result based on the meteorological prediction data and the land type around the monitoring station; and drawing a water quality change trend chart according to the adjustment value of the prediction result of different monitoring periods and displaying the chart. The application can realize high-precision prediction of the short-term change trend of water quality indexes and improve the adaptability of the model under extreme weather conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water quality detection and prediction technology, and in particular to a short-term water quality prediction method and system based on multi-feature training and meteorological correction. Background Technology

[0002] With rapid industrialization and urbanization, inland water bodies such as lakes and rivers are facing increasingly severe water pollution and ecological degradation problems. Eutrophication, the input of external pollutants, and changes in hydrodynamic conditions significantly affect the dynamic evolution of water quality parameters, posing higher demands on water environment management. Accurately predicting the changing trends of water quality indicators is of great practical significance for scientifically formulating pollution prevention and control measures and protecting the aquatic ecological environment.

[0003] Currently, water quality monitoring mainly relies on automatic ground-based water quality monitoring stations. These stations collect key water quality parameters such as water temperature, dissolved oxygen, total nitrogen (TN), and total phosphorus (TP) in real time to obtain high spatiotemporal resolution monitoring data. However, traditional monitoring methods tend to focus on static observation and lack the ability to dynamically predict future trends in water quality. Furthermore, changes in water quality indicators are influenced by multiple factors, among which rainfall, as a key meteorological factor, has a significant regulatory effect on the dynamic changes of water quality parameters.

[0004] Rainfall carries a significant amount of exogenous nutrients and pollutants into water bodies through surface runoff, which may lead to a substantial increase in the concentrations of total nitrogen (TN) and total phosphorus (TP) in the short term, increasing the risk of eutrophication. During extreme rainfall events, the concentrated inflow of pollutants can have a significant impact on the physicochemical characteristics of water bodies. Furthermore, the spatiotemporal distribution of rainfall can affect the dilution effect and self-purification capacity of water bodies. Therefore, incorporating rainfall, a key meteorological factor, into the model for dynamic correction in short-term water quality forecasting can effectively improve forecast accuracy and reduce uncertainty.

[0005] Currently, some studies have applied machine learning models (such as support vector machines, multilayer perceptrons, and regression analysis) to make short-term predictions of water quality parameters, and have achieved some progress. However, these methods have obvious limitations: 1. Single feature dependence: Most models rely only on historical water quality monitoring data and do not fully consider the influence of external driving factors such as meteorology, resulting in large prediction biases; 2. Insufficient nonlinear relationship mining: Traditional methods are difficult to fully capture the temporal evolution patterns and complex nonlinear correlations between water quality parameters; 3. Poor model adaptability: Different water bodies have significant differences in characteristics, and existing models are not very universal in various scenarios; 4. Lack of dynamic correction mechanisms: Under extreme meteorological conditions (such as heavy rain and high temperatures), the prediction results are easily affected by external uncertainties, but traditional models are difficult to effectively adjust the prediction biases.

[0006] Therefore, how to accurately predict the short-term changing trends of water quality indicators based on the full integration of multi-source feature information, and improve the adaptability of the model under extreme weather conditions, is a key problem that needs to be solved by those skilled in the art. Summary of the Invention

[0007] This application provides a short-term water quality prediction method and system based on multi-feature training and meteorological correction, which can accurately predict the short-term trend of water quality indicators and improve the model's adaptability under extreme weather conditions.

[0008] To solve the above-mentioned technical problems, this application provides the following technical solution:

[0009] A short-term water quality prediction method based on multi-feature training and meteorological correction includes the following steps: Step S1, collecting water quality parameter data and meteorological forecast data; Step S2, preprocessing the water quality parameter data collected during the monitoring period; Step S3, inputting the collected meteorological forecast data and the preprocessed water quality parameter data into a pre-trained water quality index prediction model for prediction; Step S4, adjusting the model prediction results based on the meteorological forecast data and the land type around the monitoring station; Step S5, plotting and displaying a water quality change trend chart based on the adjusted values ​​of the prediction results for different monitoring periods.

[0010] The short-term water quality prediction method based on multi-feature training and meteorological correction described above preferably includes preprocessing of water quality parameter data, comprising the following sub-steps: Step S21, outlier detection and removal of all water quality parameter data collected during the monitoring period; Step S22, missing value filling of various types of water quality parameter data after removing outlier data; Step S23, standardization of the filled water quality parameter data to complete the preprocessing of water quality parameter data.

[0011] The short-term water quality prediction method based on multi-feature training and meteorological correction described above, wherein, preferably, outlier detection and removal includes the following sub-steps: at the end of the current monitoring period, sort the collected water quality parameter data in ascending order of value; divide the sorting result into four equal parts and obtain three quantile values; calculate the dispersion based on the data between the first and third quantiles; identify outlier data based on the dispersion and quantile values, and remove them.

[0012] The short-term water quality prediction method based on multi-feature training and meteorological correction described above, wherein, preferably, the construction and training of the water quality index prediction model includes the following sub-steps: Step S31, constructing a neural network prediction model as the water quality index prediction model; Step S32, training the water quality index prediction model based on meteorological prediction data, water quality parameter data, and actual index comprehensive values ​​in the training set; Step S33, validating the trained water quality index prediction model based on meteorological prediction data, water quality parameter data, and actual index comprehensive values ​​in the validation set; Step S34, if the validation passes, the training of the water quality index prediction model is completed; otherwise, continue with Step S32.

[0013] The short-term water quality prediction method based on multi-feature training and meteorological correction described above preferably involves calculating the loss value of the predicted water quality parameter data and comparing it with a standard loss range. If the loss value of the predicted water quality parameter data is within the standard loss range, the verification is successful, and the training of the water quality index prediction model is completed. Otherwise, the verification fails, and the process returns to step S32 to continue training the water quality index prediction model.

[0014] A short-term water quality prediction system based on multi-feature training and meteorological correction includes: a data acquisition unit, a preprocessing unit, a prediction unit, an adjustment unit, and a plotting and display unit. The data acquisition unit collects water quality parameter data and meteorological prediction data; the preprocessing unit preprocesses the water quality parameter data collected during the monitoring period; the prediction unit inputs the collected meteorological prediction data and the preprocessed water quality parameter data into a pre-trained water quality index prediction model for prediction; the adjustment unit adjusts the prediction results based on the meteorological prediction data and the land type surrounding the monitoring station; and the plotting and display unit plots and displays water quality change trend charts based on the adjusted values ​​of the prediction results for different monitoring periods.

[0015] As described above, the short-term water quality prediction system based on multi-feature training and meteorological correction preferably includes a preprocessing unit comprising: a detection and removal subunit, a missing value filling subunit, and a standardization subunit; the detection and removal subunit is used to detect and remove outliers from all water quality parameter data collected within the monitoring period; the missing value filling subunit is used to fill in missing values ​​for various water quality parameter data after removing outliers; and the standardization subunit performs standardization processing on the filled water quality parameter data to complete the preprocessing of the water quality parameter data.

[0016] In the short-term water quality prediction system based on multi-feature training and meteorological correction described above, preferably, at the end of the current monitoring period, the detection and elimination subunit sorts the various water quality parameter data in ascending order of value; the detection and elimination subunit divides the sorting result into four equal parts to obtain three quantile values; the detection and elimination subunit calculates the dispersion based on the data of the first and third quantiles; the detection and elimination subunit identifies abnormal data based on the dispersion calculated by the data of the first and third quantiles and the quantile values, and eliminates them.

[0017] The short-term water quality prediction system based on multi-feature training and meteorological correction described above preferably further includes: a model building and training unit, which comprises: a construction subunit, a training subunit, and a validation subunit; the construction subunit is used to build a neural network prediction model; the training subunit trains the model based on the meteorological prediction data, water quality parameter data, and actual index comprehensive values ​​in the training set; the validation subunit validates the model based on the meteorological prediction data, water quality parameter data, and actual index comprehensive values ​​in the validation set; if the validation subunit passes the validation, the training of the water quality index prediction model is completed; otherwise, the training subunit continues training.

[0018] In the short-term water quality prediction system based on multi-feature training and meteorological correction described above, preferably, the verification subunit calculates the loss value of the predicted water quality parameter data and compares it with the standard loss range. If the loss value of the predicted water quality parameter data is within the standard loss range, the verification is successful and the training of the water quality index prediction model is completed; otherwise, the verification fails and the training subunit continues to train the water quality index prediction model.

[0019] Compared with the aforementioned background technologies, this application fully explores the nonlinear relationship and spatiotemporal dependence between water quality parameter data and meteorological forecast data, and can dynamically predict the water quality of lakes, rivers and other water bodies, significantly improving the accuracy and stability of water quality prediction. Especially under special meteorological conditions such as extreme rainfall, this application can effectively correct the prediction results and reduce the impact of uncertainty on prediction performance. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0021] Figure 1 This is a flowchart of the short-term water quality prediction method based on multi-feature training and meteorological correction in this application;

[0022] Figure 2 This is a flowchart of the water quality parameter data preprocessing process in this application;

[0023] Figure 3 This is a flowchart of the construction and training of the water quality index prediction model in this application;

[0024] Figure 4 This is a line graph of the accuracy evaluation of the water quality index prediction validation set in this application;

[0025] Figure 5 This is a bar chart showing the water quality prediction results in this application;

[0026] Figure 6 This is a schematic diagram of the short-term water quality prediction system based on multi-feature training and meteorological correction in this application;

[0027] Figure 7 This is an accuracy evaluation chart of the predicted results of various water quality parameters in this application. Detailed Implementation

[0028] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. Additionally, spatial relation terms such as "upper," "lower," "front," "rear," "left," and "right" are used for ease of description to explain the positional relationship between two components. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0029] Example 1

[0030] like Figure 1 As shown, this application provides a short-term water quality prediction method based on multi-feature training and meteorological correction, including the following steps:

[0031] Step S1: Collect water quality parameter data and meteorological forecast data;

[0032] Automatic water quality monitoring stations are set up near water bodies such as lakes and rivers. During the monitoring period, the current water quality parameters are collected through the API interface of the automatic water quality monitoring stations according to the predetermined collection strategy. The collected water quality parameters include: water temperature (TEMP), dissolved oxygen (DO), turbidity (NTU), total nitrogen (TN), total phosphorus (TP), permanganate index (CODMn), ammonia nitrogen (NH3-N), etc.

[0033] Meanwhile, during the monitoring period, meteorological forecast data such as future cumulative rainfall (TPS) are obtained using the Open-Meteo API according to the predetermined acquisition strategy. The Open-Meteo API is an open-source and free weather API that provides high-precision hourly weather forecasts and historical data worldwide.

[0034] The data collection strategy for water quality parameters can be the same as the data collection strategy for meteorological forecasts, meaning that the number of water quality parameter data collected within a monitoring period is the same as the number of meteorological forecast data collected. Alternatively, the data collection strategy for water quality parameters can be different from the data collection strategy for meteorological forecasts, meaning that the number of water quality parameter data collected within a monitoring period is different from the number of meteorological forecast data collected.

[0035] Step S2: Preprocess the water quality parameter data collected during the monitoring period;

[0036] During the monitoring period, water quality parameter data are collected according to the predetermined collection strategy. All water quality parameter data collected during the monitoring period are preprocessed to remove abnormal data and complete any missing data to ensure the quality of the water quality parameter data.

[0037] Specifically, such as Figure 2 As shown, the preprocessing of water quality parameter data includes the following sub-steps:

[0038] Step S21: Detect and remove outliers from all water quality parameter data collected during the monitoring period;

[0039] First, at the end of the current monitoring period, all water quality parameter data collected during the current monitoring period are sorted in ascending order of value.

[0040] Then, the sorted water quality parameter data are divided into four equal parts, and the values ​​of the three quantiles for each part are obtained. The positions of the three quantiles are obtained: the position of the first quantile is W1 = (n+1) × 0.25, the position of the second quantile is W2 = (n+1) × 0.5, and the position of the third quantile is W3 = (n+1) × 0.75, where n is the number of water quality parameter data collected during the monitoring period. Based on the positions of the three quantiles and the water quality parameter data related to the corresponding positions, the value of each quantile is determined: Q1 for the first quantile, Q2 for the second quantile, and Q3 for the third quantile.

[0041] Specifically, if the water quality parameter data at a quantile is an integer, then the value of the water quality parameter data is the value of that quantile; if the water quality parameter data at a quantile is not an integer, then the integer part and the fractional part of the water quality parameter data are separated, the value of the integer part is denoted as a, the value of the fractional part is denoted as b, and the value of the water quality parameter data at the next position of that quantile is denoted as c. Then a + (ca) × b is taken as the value of that quantile.

[0042] Next, the dispersion of water quality parameter data between the first and second quantiles is calculated based on the value Q3 of the third quantile and the value Q1 of the first quantile. Specifically, this is calculated using the formula IQR. 13 =Q3-Q1, calculates the dispersion of water quality parameter data between the first and third quantiles (50% of the range).

[0043] Finally, based on the dispersion (IQR) of water quality parameter data between the first and second quantiles. 13 The system uses the values ​​Q1 and Q3 of the first quantile to identify and remove abnormal data from the sorted water quality parameter data.

[0044] Specifically, based on the following formula:

[0045] lower_bound = Q1 - 1.5 × IQR 13

[0046] upper_bound = Q3 + 1.5 × IQR 13

[0047] The lowest anomaly threshold (lower_bound) and the highest anomaly threshold (upper_bound) are calculated. Data in the sorted water quality parameter data that are lower than the lowest anomaly threshold (lower_bound) and higher than the highest anomaly threshold (upper_bound) are considered as anomaly data.

[0048] Step S22: Fill in missing values ​​for various water quality parameter data after removing abnormal data;

[0049] After removing outlier data, the water quality parameter data for each category are sorted according to the collection time. Then, the time when the data is missing in each category is identified, and the missing values ​​are filled in using the water quality parameter data from the time before that time, so as to avoid the reduction in data volume caused by the removal of outlier data.

[0050] Step S23: Standardize the water quality parameter data after filling to complete the preprocessing of the water quality parameter data;

[0051] After imputing missing values ​​for each type of water quality parameter data, all water quality parameter data in the set of that type of water quality parameter data are traversed to obtain the minimum and maximum values ​​of that type of water quality parameter data. Based on the minimum and maximum values ​​of that type of water quality parameter data, each water quality parameter data in that type of water quality parameter data is standardized to ensure that the water quality parameter data is within a predetermined range, which helps the subsequent water quality index prediction model training converge.

[0052] Specifically, based on the following formula:

[0053]

[0054] Obtain the standardized value x of the j-th water quality parameter data of the i-th type of water quality parameter data. ijnorm ; where x ij For the j-th water quality parameter data of the i-th type of water quality parameter data; x imin x represents the minimum value of the i-th type of water quality parameter data; imax This represents the maximum value of the i-th type of water quality parameter data.

[0055] Step S3: Input the collected meteorological forecast data and preprocessed water quality parameter data into the pre-trained water quality index prediction model for prediction.

[0056] After the current monitoring period ends, the meteorological forecast data and pre-processed water quality parameter data collected during the monitoring period will be input into the pre-trained water quality index prediction model so that the water quality can be predicted through the water quality index prediction model.

[0057] Among them, such as Figure 3 As shown, the construction and training of the water quality index prediction model includes the following sub-steps:

[0058] Step S31: Construct a neural network prediction model as a water quality index prediction model;

[0059] A neural network prediction model was constructed as a water quality indicator prediction model. Specifically, the constructed water quality indicator prediction model is as follows:

[0060]

[0061] Where, x ijnormt Let be the standardized value of the j-th water quality parameter data of the i-th water quality parameter data at time t; J is the number of water quality parameter data in the i-th water quality parameter data; α i ρ represents the weight value corresponding to the i-th type of water quality parameter data; t y represents the weight value corresponding to time t within the monitoring period; T is the duration of the monitoring period; mTFor the m-th type of meteorological forecast data collected within the monitoring period T; μ m y represents the weight value corresponding to the m-th type of meteorological forecast data; M is the number of types of meteorological forecast data; zb This is a comprehensive standard value for meteorological forecast data; β is the comprehensive value of the actual indicators of the i-th water quality parameter data within the previous monitoring period T-1; i1 β represents the influence weight of the actual comprehensive value of the i-th water quality parameter data relative to the water quality parameter data within the previous monitoring period T-1; i2 β represents the weighting of the combined actual value of the i-th water quality parameter data within the previous monitoring period T-1 relative to the meteorological forecast data; i1 +β i2 =1; ω1 is the combined influence weight of the actual index composite value and water quality parameter data; ω2 is the combined influence weight of the actual index composite value and meteorological forecast data; This represents the comprehensive predicted value of the i-th type of water quality parameter data within the current monitoring period T.

[0062] Since the input to the water quality index prediction model includes not only water quality parameter data but also meteorological forecast data collected using the Open-Meteo API, the prediction results obtained through this water quality index prediction model are more accurate, reducing the error impact caused by the uncertainty of meteorological data.

[0063] Step S32: Train the water quality index prediction model based on the meteorological forecast data, water quality parameter data and actual index comprehensive values ​​in the training set;

[0064] After constructing the water quality index prediction model, it is trained. Since meteorological forecast data and water quality parameter data were collected at the previous historical moment, the actual water quality at the next historical moment is known. Therefore, when training the water quality index prediction model, the meteorological forecast data and water quality parameter data of the corresponding monitoring period in the training set, along with the actual index comprehensive value of the previous monitoring period, are used as the input to the water quality index prediction model. The actual index comprehensive value of the corresponding monitoring period in the training set is used as the output of the water quality index prediction model. This process explores the temporal evolution characteristics of water quality indicators and the nonlinear relationships between multiple features to train the water quality index prediction model. The actual index comprehensive value represents the actual water quality, and the predicted index comprehensive value represents the predicted water quality. For example, the actual index comprehensive value of the i-th type of water quality parameter data represents the actual water quality with respect to the i-th type of indicator, and the predicted index comprehensive value of the i-th type of water quality parameter data represents the predicted water quality with respect to the i-th type of indicator.

[0065] Step S33: Use the combined values ​​of meteorological forecast data, water quality parameter data and actual indicators from the validation set to validate the trained water quality indicator prediction model;

[0066] After the water quality index prediction model is trained, the meteorological forecast data and water quality parameter data for the corresponding monitoring period in the validation set, as well as the comprehensive value of the actual index for the previous monitoring period, are used as inputs to the trained water quality index prediction model to obtain the comprehensive predicted index value for the corresponding monitoring period. Then, the comprehensive predicted index value and the comprehensive value of the actual index for the corresponding monitoring period in the validation set are used for validation. Figure 4 This is a line graph showing the accuracy evaluation of the water quality index prediction validation set in this application.

[0067] Specifically, the water quality index prediction model was validated using the following loss function:

[0068]

[0069] Among them, YZ iw The loss value is the predicted result of the i-th type of water quality parameter data; σ is the comprehensive value of the actual index of the i-th water quality parameter data within the monitoring period T; σ is the adjustment value, which is a positive integer 1; K is the number of validation data sets.

[0070] Step S34: If the verification is successful, the training of the water quality index prediction model is completed; otherwise, continue to step S32.

[0071] The loss value YZ obtained from the prediction results of the i-th type of water quality parameter data iw Then, the loss value YZ of the predicted results of the i-th type of water quality parameter data is... iw Compare with the standard loss range. If the loss value YZ of the predicted result for the i-th type of water quality parameter data... iw If the loss value is within the standard loss range, the validation is successful, and the training of the water quality index prediction model is complete; if the loss value YZ iw If the loss exceeds the standard range, the verification fails, and the process returns to step S32 to continue training the water quality index prediction model.

[0072] Step S4: Adjust the model prediction results based on meteorological forecast data and the land type around the monitoring station;

[0073] Based on meteorological forecast data within the monitoring period, adjustment weights are obtained for the corresponding meteorological types (e.g., high rainfall scenarios). Based on different land types around the monitoring points (e.g., land use types and distribution characteristics), corresponding adjustment parameters are obtained. The prediction results of the water quality index prediction model are adjusted according to the adjustment weights and adjustment parameters to more accurately reflect the pollutant input and water quality change trends caused by rainfall.

[0074] Specifically, the prediction results are adjusted according to the following formula:

[0075]

[0076] in, for The adjustment value; τ y To adjust the weights; E r δ is the adjustment parameter corresponding to the r-th land type around the monitoring point; r For E r The corresponding weights; Let r be the percentage of the land area corresponding to the r-th land type around the monitoring point. R represents the number of land types surrounding the monitoring point.

[0077] Step S5: Based on the adjusted values ​​of the prediction results for different monitoring periods, draw and display a water quality change trend chart;

[0078] After obtaining the adjusted values ​​for the prediction results of different monitoring periods, these adjusted values ​​are used to generate a continuous time series water quality change trend chart, such as... Figure 5 As shown, it can provide accuracy assessment indicators (such as RMSE, MAPE), display water quality change trend charts on the screen, and also support the download function of water quality change trend charts for users to store and further analyze.

[0079] In Example 1, steps S1 to S5 are all software programs executed by a computer.

[0080] Example 2

[0081] like Figure 6 As shown, this application provides a short-term water quality prediction system 700 based on multi-feature training and meteorological correction, including: a data acquisition unit 710, a preprocessing unit 720, a prediction unit 730, an adjustment unit 740, and a drawing and display unit 750.

[0082] The acquisition unit 710 is used to collect water quality parameter data and meteorological forecast data.

[0083] Automatic water quality monitoring stations are set up near water bodies such as lakes and rivers. During the monitoring period, the acquisition unit 710 collects the current water quality parameter data through the API interface of the automatic water quality monitoring station according to the predetermined acquisition strategy. The collected water quality parameter data includes: water temperature (TEMP), dissolved oxygen (DO), turbidity (NTU), total nitrogen (TN), total phosphorus (TP), permanganate index (CODMn), ammonia nitrogen (NH3-N), etc.

[0084] Meanwhile, during the monitoring period, the acquisition unit 710 uses the Open-Meteo API to acquire meteorological forecast data such as future cumulative rainfall (TPS) according to a predetermined acquisition strategy. The Open-Meteo API is an open-source and free weather API that provides high-precision hourly weather forecasts and historical data worldwide.

[0085] The data collection strategy for water quality parameters can be the same as the data collection strategy for meteorological forecasts, meaning that the number of water quality parameter data collected within a monitoring period is the same as the number of meteorological forecast data collected. Alternatively, the data collection strategy for water quality parameters can be different from the data collection strategy for meteorological forecasts, meaning that the number of water quality parameter data collected within a monitoring period is different from the number of meteorological forecast data collected.

[0086] The preprocessing unit 720 is used to preprocess the water quality parameter data collected during the monitoring period.

[0087] During the monitoring period, after collecting water quality parameter data according to the predetermined collection strategy, the preprocessing unit 720 performs preprocessing operations on all water quality parameter data collected during the monitoring period, removes abnormal data, and completes the missing data in the water quality parameter data to ensure the quality of the water quality parameter data.

[0088] Specifically, the preprocessing unit 720 includes: a detection and removal subunit 721, a missing value filling subunit 722, and a normalization processing subunit 723.

[0089] The detection and rejection subunit 721 is used to detect and reject outliers in all water quality parameter data collected during the monitoring period.

[0090] First, at the end of the current monitoring period, all water quality parameter data collected during the current monitoring period are sorted in ascending order of value.

[0091] Then, the sorted water quality parameter data are divided into four equal parts, and the values ​​of the three quantiles for each part are obtained. The positions of the three quantiles are obtained: the position of the first quantile is W1 = (n+1) × 0.25, the position of the second quantile is W2 = (n+1) × 0.5, and the position of the third quantile is W3 = (n+1) × 0.75, where n is the number of water quality parameter data collected during the monitoring period. Based on the positions of the three quantiles and the water quality parameter data related to the corresponding positions, the value of each quantile is determined: Q1 for the first quantile, Q2 for the second quantile, and Q3 for the third quantile.

[0092] Specifically, if the water quality parameter data at a quantile is an integer, then the value of the water quality parameter data is the value of that quantile; if the water quality parameter data at a quantile is not an integer, then the integer part and the fractional part of the water quality parameter data are separated, the value of the integer part is denoted as a, the value of the fractional part is denoted as b, and the value of the water quality parameter data at the next position of that quantile is denoted as c. Then a + (ca) × b is taken as the value of that quantile.

[0093] Next, the dispersion of water quality parameter data between the first and second quantiles is calculated based on the value Q3 of the third quantile and the value Q1 of the first quantile. Specifically, this is calculated using the formula IQR. 13 =Q3-Q1, calculates the dispersion of water quality parameter data between the first and third quantiles (50% of the range).

[0094] Finally, based on the dispersion (IQR) of water quality parameter data between the first and second quantiles. 13 The system uses the values ​​of the first quantile (Q1) and the third quantile (Q3) to identify and remove abnormal data from the sorted water quality parameter data.

[0095] Specifically, based on the following formula:

[0096] lower_bound = Q1 - 1.5 × IQR 13

[0097] upper_bound = Q3 + 1.5 × IQR 13

[0098] The lowest anomaly threshold (lower_bound) and the highest anomaly threshold (upper_bound) are calculated. Data in the sorted water quality parameter data that are lower than the lowest anomaly threshold (lower_bound) and higher than the highest anomaly threshold (upper_bound) are considered as anomaly data.

[0099] The missing value filling subunit 722 is used to fill missing values ​​in various water quality parameter data after removing abnormal data.

[0100] After removing outlier data, the water quality parameter data for each category are sorted according to the collection time. Then, the time when the data is missing in each category is identified, and the missing values ​​are filled in using the water quality parameter data from the time before that time, so as to avoid the reduction in data volume caused by the removal of outlier data.

[0101] The standardization processing subunit 723 is used to standardize the water quality parameter data to complete the preprocessing of the water quality parameter data.

[0102] After imputing missing values ​​for each type of water quality parameter data, all water quality parameter data in the set of that type of water quality parameter data are traversed to obtain the minimum and maximum values ​​of that type of water quality parameter data. Based on the minimum and maximum values ​​of that type of water quality parameter data, each water quality parameter data in that type of water quality parameter data is standardized to ensure that the water quality parameter data is within a predetermined range, which helps the subsequent water quality index prediction model training converge.

[0103] Specifically, based on the following formula:

[0104]

[0105] Obtain the standardized value x of the j-th water quality parameter data of the i-th type of water quality parameter data. ijnorm ; where x ij For the j-th water quality parameter data of the i-th type of water quality parameter data; x imin x represents the minimum value of the i-th type of water quality parameter data; imax This represents the maximum value of the i-th type of water quality parameter data.

[0106] The prediction unit 730 is used to input the collected meteorological forecast data and pre-processed water quality parameter data into a pre-trained water quality index prediction model for prediction.

[0107] After the current monitoring period ends, the meteorological forecast data and pre-processed water quality parameter data collected during the monitoring period will be input into the pre-trained water quality index prediction model so that the water quality can be predicted through the water quality index prediction model.

[0108] The short-term water quality prediction system 700 also includes a model building and training unit 760; the model building and training unit 760 includes a construction subunit 761, a training subunit 762, and a validation subunit 763.

[0109] Subunit 761 is used to build a neural network prediction model as a water quality indicator prediction model.

[0110] A neural network prediction model was constructed as a water quality indicator prediction model. Specifically, the constructed water quality indicator prediction model is as follows:

[0111]

[0112] Where, x ijnormt Let be the standardized value of the j-th water quality parameter data of the i-th water quality parameter data at time t; J is the number of water quality parameter data in the i-th water quality parameter data; α i ρ represents the weight value corresponding to the i-th type of water quality parameter data; ty represents the weight value corresponding to time t within the monitoring period; T is the duration of the monitoring period; mT For the m-th type of meteorological forecast data collected within the monitoring period T; μ m y represents the weight value corresponding to the m-th type of meteorological forecast data; M is the number of types of meteorological forecast data; zb This is a comprehensive standard value for meteorological forecast data; β is the comprehensive value of the actual indicators of the i-th water quality parameter data within the previous monitoring period T-1; i1 β represents the influence weight of the actual comprehensive value of the i-th water quality parameter data relative to the water quality parameter data within the previous monitoring period T-1; i2 β represents the weighting of the combined actual value of the i-th water quality parameter data within the previous monitoring period T-1 relative to the meteorological forecast data; i1 +β i2 =1; ω1 is the combined influence weight of the actual index composite value and water quality parameter data; ω2 is the combined influence weight of the actual index composite value and meteorological forecast data; This represents the comprehensive predicted value of the i-th type of water quality parameter data within the current monitoring period T.

[0113] Since the input to the water quality index prediction model includes not only water quality parameter data but also meteorological forecast data collected using the Open-Meteo API, the prediction results obtained through this water quality index prediction model are more accurate, reducing the error impact caused by the uncertainty of meteorological data.

[0114] Training subunit 762 trains the model based on the meteorological forecast data, water quality parameter data and actual index values ​​in the training set.

[0115] After constructing the water quality index prediction model, it is trained. Since meteorological forecast data and water quality parameter data were collected at the previous historical moment, the actual water quality at the next historical moment is known. Therefore, when training the water quality index prediction model, the meteorological forecast data and water quality parameter data of the corresponding monitoring period in the training set, along with the actual index comprehensive value of the previous monitoring period, are used as the input to the water quality index prediction model. The actual index comprehensive value of the corresponding monitoring period in the training set is used as the output of the water quality index prediction model. This process explores the temporal evolution characteristics of water quality indicators and the nonlinear relationships between multiple features to train the water quality index prediction model. The actual index comprehensive value represents the actual water quality, and the predicted index comprehensive value represents the predicted water quality. For example, the actual index comprehensive value of the i-th type of water quality parameter data represents the actual water quality with respect to the i-th type of indicator, and the predicted index comprehensive value of the i-th type of water quality parameter data represents the predicted water quality with respect to the i-th type of indicator.

[0116] The validation subunit 763 validates the trained model based on the combined values ​​of meteorological forecast data, water quality parameter data, and actual indicators in the validation set.

[0117] After the water quality index prediction model is trained, the meteorological forecast data and water quality parameter data for the corresponding monitoring period in the validation set, as well as the comprehensive value of the actual index for the previous monitoring period, are used as inputs to the trained water quality index prediction model to obtain the comprehensive predicted index value for the corresponding monitoring period. Then, the comprehensive predicted index value and the comprehensive value of the actual index for the corresponding monitoring period in the validation set are used for validation. Figure 4 This is a line graph showing the accuracy evaluation of the water quality index prediction validation set in this application.

[0118] Specifically, the water quality index prediction model was validated using the following loss function:

[0119]

[0120] Among them, YZ iw The loss value is the predicted result of the i-th type of water quality parameter data; σ is the comprehensive value of the actual index of water quality parameter data of type i within the monitoring period T; σ is the adjustment value, which is a positive integer 1; K is the number of validation data sets.

[0121] If the verification subunit 763 passes the verification, the training of the water quality index prediction model is completed; otherwise, the training subunit 762 continues the training.

[0122] The loss value YZ obtained from the prediction results of the i-th type of water quality parameter data iw Then, the loss value YZ predicted from the i-th type of water quality parameter data is... iw Compare with the standard loss range. If the predicted loss value YZ from the i-th type of water quality parameter data... iw If the loss value is within the standard loss range, the validation is successful, and the training of the water quality index prediction model is complete; if the loss value YZ iw If the loss exceeds the standard range, the verification fails, and training subunit 762 continues to train the water quality index prediction model.

[0123] The adjustment unit 740 is used to adjust the forecast results based on meteorological forecast data and the land type around the monitoring station.

[0124] Based on meteorological forecast data within the monitoring period, adjustment weights are obtained for the corresponding meteorological types (e.g., high rainfall scenarios). Based on different land types around the monitoring points (e.g., land use types and distribution characteristics), corresponding adjustment parameters are obtained. The prediction results of the water quality index prediction model are adjusted according to the adjustment weights and adjustment parameters to more accurately reflect the pollutant input and water quality change trends caused by rainfall.

[0125] Specifically, the prediction results are adjusted according to the following formula:

[0126]

[0127] in, for The adjustment value; τ y To adjust the weights; E r δ is the adjustment parameter corresponding to the r-th land type around the monitoring point; r For E r The corresponding weights; Let r be the percentage of the land area corresponding to the r-th land type around the monitoring point. R represents the number of land types surrounding the monitoring point.

[0128] The drawing and display unit 750 is used to draw and display water quality change trend charts based on the adjustment values ​​of the prediction results for different monitoring cycles.

[0129] After obtaining the adjusted values ​​for the prediction results of different monitoring periods, these adjusted values ​​are used to generate a continuous time series water quality change trend chart, such as... Figure 5 As shown, it can provide accurate assessment indicators (such as RMSE, MAPE), display water quality change trend charts on the screen, and also support the download function of water quality change trend charts for users to store and further analyze.

[0130] In Embodiment 2, the acquisition unit 710, preprocessing unit 720, prediction unit 730, adjustment unit 740, drawing and display unit 750, and model building and training unit 760 are all computer modules.

[0131] To verify the accuracy of the short-term water quality prediction method and system based on multi-feature training and meteorological correction described in this application, the following data comparison is performed.

[0132] Combination Figure 7 As shown, Figure 7 The accuracy evaluation chart of the prediction results (comprehensive value of prediction indicators) for various water quality parameters is presented. Based on the accuracy evaluation results of the water quality indicator prediction model proposed in this application, taking the water quality prediction results of the Weicun automatic water quality monitoring station from June 1st to June 10th, 2024 as an example, the root mean square error (RMSE) and mean absolute percentage error (MAPE) were calculated by comparing the actual measured values ​​and predicted values ​​of various water quality indicators.

[0133] The results show that the proposed water quality indicator prediction model has high prediction accuracy. Specifically, the RMSE for DO is 0.081 and the MAPE is 1.02%; the RMSE for TP is 0.0017 and the MAPE is 1.95%; the RMSE for TN is 0.101 and the MAPE is 4.53%; and the RMSE for CODMn is 0.178 and the MAPE is 8.72%. These data indicate that the water quality indicator prediction model of this application exhibits good fitting effect and reliability when predicting different water quality conditions, accurately reflects the actual trend of water quality changes, and is suitable for online water quality monitoring and management.

[0134] This application has at least the following beneficial effects:

[0135] This application utilizes water quality parameter data collected by automatic water quality monitoring stations and open-source meteorological forecast data to construct an efficient short-term water quality parameter prediction model. It fully explores the nonlinear relationship and spatiotemporal dependence between water quality parameter data and meteorological forecast data, and can dynamically predict the water quality of lakes, rivers and other water bodies, significantly improving the accuracy and stability of water quality prediction. Especially under special meteorological conditions such as extreme rainfall, this application can effectively correct the prediction results and reduce the impact of uncertainty on prediction performance.

[0136] In addition, the prediction results generated by this application can be displayed intuitively in the form of charts and graphs, and support data download function, providing an efficient decision support tool for the scientific deployment of water pollution prevention and control measures and the protection of aquatic ecosystems.

[0137] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0138] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A short-term water quality prediction method based on multi-feature training and meteorological correction, characterized in that, Includes the following steps: Step S1: Collect water quality parameter data and meteorological forecast data; Step S2: Preprocess the water quality parameter data collected during the monitoring period; The preprocessing of the water quality parameter data includes the following sub-steps: Step S21: Detect and remove outliers from all water quality parameter data collected during the monitoring period; Step S22: Fill in missing values ​​for various water quality parameter data after removing abnormal data; Step S23: Standardize the water quality parameter data after filling to complete the preprocessing of the water quality parameter data; Step S3: Input the collected meteorological forecast data and preprocessed water quality parameter data into the pre-trained water quality index prediction model for prediction. The construction and training of the water quality index prediction model includes the following sub-steps: Step S31: Construct a neural network prediction model as a water quality index prediction model; The constructed water quality index prediction model is as follows: ; in, For a moment Time The first water quality parameter data Standardized values ​​of individual water quality parameters; For the first The number of water quality parameter data in the Class I water quality parameter data; For the first Weight values ​​corresponding to water quality parameter data; For the time within the monitoring period The corresponding weight value; The duration of the monitoring period; For monitoring cycle The first internal collection Weather forecast data; For the first Weight values ​​corresponding to meteorological forecast data; The number of types of meteorological forecast data; This is a comprehensive standard value for meteorological forecast data; For the previous monitoring period Inner The comprehensive value of actual indicators of Class I water quality parameters; For the previous monitoring period Inner The influence weight of the actual comprehensive value of water quality parameter data relative to the water quality parameter data; For the previous monitoring period Inner The influence weight of the actual comprehensive value of water quality parameter data relative to meteorological forecast data; ; The combined influence weight of actual indicator composite values ​​and water quality parameter data; The combined influence weight of actual indicator composite value and meteorological forecast data; For the current monitoring period Inner Comprehensive value of predicted indicators for Class I water quality parameters; Step S32: Train the water quality index prediction model based on the meteorological forecast data, water quality parameter data and actual index comprehensive values ​​in the training set; Step S33: Validate the trained water quality index prediction model based on the combined values ​​of meteorological forecast data, water quality parameter data, and actual indicators from the validation set. Step S34: If the verification is successful, the training of the water quality index prediction model is completed; otherwise, continue to step S32. Step S4: Adjust the model prediction results based on meteorological forecast data and the land type around the monitoring station; Step S5: Based on the adjusted values ​​of the prediction results for different monitoring cycles, draw and display a water quality change trend chart.

2. The short-term water quality prediction method based on multi-feature training and meteorological correction according to claim 1, characterized in that, Outlier detection and removal includes the following sub-steps: At the end of the current monitoring cycle, the collected water quality parameter data will be sorted from smallest to largest. The sorting result is divided into four equal parts, and the values ​​of the three quantile points are obtained. The dispersion is calculated based on the data between the first and third quantiles; Abnormal data is identified and removed based on dispersion and quantile values.

3. The short-term water quality prediction method based on multi-feature training and meteorological correction according to claim 1, characterized in that, The loss value is predicted by calculating the water quality parameter data and compared with the standard loss range; If the loss value of the predicted water quality parameter data is within the standard loss range, the verification is successful and the training of the water quality index prediction model is completed; otherwise, the verification fails and the process returns to step S32 to continue training the water quality index prediction model.

4. A short-term water quality prediction system based on multi-feature training and meteorological correction, characterized in that, include: The system includes an acquisition unit, a preprocessing unit, a prediction unit, an adjustment unit, and a drawing and display unit. The acquisition unit is used to collect water quality parameter data and meteorological forecast data; The preprocessing unit is used to preprocess the water quality parameter data collected during the monitoring period; The preprocessing unit includes: a detection and removal subunit, a missing value imputation subunit, and a normalization processing subunit; The detection and rejection subunit is used to detect and reject outliers in all water quality parameter data collected during the monitoring period. The missing value filling sub-unit is used to fill in missing values ​​for various water quality parameter data after removing outlier data; The standardization processing subunit is used to standardize the water quality parameter data after filling in order to complete the preprocessing of the water quality parameter data; The prediction unit is used to input the collected meteorological forecast data and preprocessed water quality parameter data into a pre-trained water quality index prediction model for prediction. It also includes a model building and training unit, which includes: Construct sub-units for building neural network prediction models; The constructed water quality index prediction model is as follows: ; in, For a moment Time The first water quality parameter data Standardized values ​​of individual water quality parameters; For the first The number of water quality parameter data in the Class I water quality parameter data; For the first Weight values ​​corresponding to water quality parameter data; For the time within the monitoring period The corresponding weight value; The duration of the monitoring period; For monitoring cycle The first internal collection Weather forecast data; For the first Weight values ​​corresponding to meteorological forecast data; The number of types of meteorological forecast data; This is a comprehensive standard value for meteorological forecast data; For the previous monitoring period Inner The comprehensive value of actual indicators of Class I water quality parameters; For the previous monitoring period Inner The influence weight of the actual comprehensive value of water quality parameter data relative to the water quality parameter data; For the previous monitoring period Inner The influence weight of the actual comprehensive value of water quality parameter data relative to meteorological forecast data; ; The combined influence weight of actual indicator composite values ​​and water quality parameter data; The combined influence weight of actual indicator composite value and meteorological forecast data; For the current monitoring period Inner Comprehensive value of predicted indicators for Class I water quality parameters; The training subunit trains the model based on the meteorological forecast data, water quality parameter data, and actual index values ​​in the training set. The validation subunit validates the model based on the combined values ​​of meteorological forecast data, water quality parameter data, and actual indicators from the validation set. If the verification subunit passes the verification, the training of the water quality index prediction model is completed; otherwise, the training subunit continues to be trained. The adjustment unit is used to adjust the forecast results based on meteorological forecast data and the land type around the monitoring station; The drawing and display unit is used to draw and display water quality change trend charts based on the adjusted values ​​of the prediction results for different monitoring cycles.

5. The short-term water quality prediction system based on multi-feature training and meteorological correction according to claim 4, characterized in that, At the end of the current monitoring cycle, the detection and rejection sub-unit will sort the collected water quality parameter data in ascending order of value; The detection and elimination sub-units divide the sorting results into four equal parts and obtain three quantile values; The detection and elimination sub-units calculate the dispersion based on the data from the first and third quantiles; The detection and elimination sub-unit uses the dispersion calculated from the water data at the first and third quantiles, as well as the quantile values, to identify and eliminate abnormal data.

6. The short-term water quality prediction system based on multi-feature training and meteorological correction according to claim 4, characterized in that, The verification subunit calculates the loss value of the predicted water quality parameter data and compares it with the standard loss range. If the loss value of the predicted water quality parameter data is within the standard loss range, the verification is successful and the training of the water quality index prediction model is completed. Conversely, if the verification fails, the training sub-unit continues to train the water quality index prediction model.