Runoff simulation method and system coupling SWAT model and machine learning algorithm
By combining the SWAT model with machine learning algorithms, especially LSTM and GAT networks, and optimizing hyperparameters, the problem of insufficient simulation capabilities for runoff and flood processes in existing technologies has been solved, achieving more accurate runoff simulation and extreme flood prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-08
AI Technical Summary
Existing runoff simulation technologies fail to fully couple the ability of hydrological models to simulate physical processes with the advantages of machine learning algorithms in processing spatiotemporal data, resulting in insufficient simulation capabilities for daily runoff and flood processes.
By combining the SWAT model with machine learning algorithms, the temporal dependence and directed confluence relationship of hydrological processes are captured through LSTM and GAT networks. SL and SGL models are constructed, and hyperparameters are optimized to improve simulation accuracy.
It achieves more accurate runoff simulation, especially with a significant improvement in simulation results during extreme flood processes. It has a clear physical mechanism and scientific rationality, and is close to engineering practice.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning algorithms, hydrological models, and runoff simulation, and particularly to a runoff simulation method and system that couples the SWAT model with machine learning algorithms. Background Technology
[0002] Water resource vulnerability continues to increase, and water scarcity and extreme droughts and floods have become core challenges restricting regional sustainable development. As a key quantitative indicator of the water cycle, accurate runoff simulation is not only crucial for understanding terrestrial water cycle mechanisms and predicting future hydrological evolution, but also provides quantitative evidence for the scientific regulation and optimal allocation of water resources in various river basins. Furthermore, as a key technological support for establishing an efficient disaster prevention and mitigation system and ensuring stable socio-economic operation, it holds significant strategic importance for supporting the sustainable development of river basins.
[0003] Existing runoff simulation techniques are mainly divided into two categories: physical hydrological models and machine learning (ML) models. However, both have significant drawbacks: physical hydrological models simulate watershed rainfall-runoff processes by coupling structures and parameters. Simulation accuracy depends on parameter calibration and data quality, and parameter optimization is time-consuming and difficult to find a globally optimal solution. Furthermore, physical models lack the ability to simulate runoff processes effectively. ML, on the other hand, possesses strong nonlinear fitting capabilities, allowing for flexible adaptation to runoff simulation needs under different hydrological conditions. Long Short-Term Memory (LSTM) networks, with their advantages in processing time-series data, are widely used in hydrological runoff simulation tasks. Some researchers have considered the spatiotemporal correlation of runoff processes, coupling LSTM with machine learning algorithms that reflect topological relationships for application in the hydrological field. ML, however, lacks physical mechanism support and has weak interpretability. The coupling of physical mechanisms in hydrological models with machine learning has become a core research hotspot in hydrological simulation.
[0004] Currently, existing research generally suffers from the following problems: (1) Most models use undirected graph algorithms to characterize spatial relationships, which fail to adapt to the directional confluence characteristics of the "upstream-downstream" watershed; (2) Some models do not fully incorporate physical process variables and still use meteorological data as the main input, resulting in insufficient correlation between physical logic and simulation results. Overall, existing research has failed to fully couple the simulation capabilities of hydrological models for physical processes with the advantages of machine learning algorithms in processing spatiotemporal data. Summary of the Invention
[0005] This invention provides a runoff simulation method and system that couples the SWAT model with a machine learning algorithm, in order to solve the problem that the existing technology fails to fully couple the simulation capability of the hydrological model to the actual runoff generation and confluence physical process with the advantages of the machine learning algorithm in processing spatiotemporal data, resulting in insufficient simulation capability for daily runoff and flood processes.
[0006] In a first aspect, the present invention provides a runoff simulation method that couples a SWAT model with a machine learning algorithm, comprising:
[0007] Spatial data of the study watershed, meteorological data of the study period, and measured runoff data from hydrological stations were acquired. The spatial data includes Digital Elevation Model (DEM), land use data, and soil type data. Spatial data input into the SWAT model must be projected to the same coordinate system. The DEM data is latitude and longitude segmented data, which undergoes mosaicking, projection, and depression filling to obtain preprocessed DEM data. The land use data needs to be merged by province and city, projected, reclassified, and a land use type index table created to obtain preprocessed land use data. The soil data is projected and cropped. Soil groups are merged based on the SU_SYM90 field in the HWSD soil database within the study watershed to improve the soil database and establish a soil type index table, resulting in preprocessed soil data. The preprocessed DEM data is input into the SWAT model to extract river channels and divide sub-basins. The preprocessed soil data, land use data, and slope data are input into the SWAT model to generate Hydrological Response Units (HRUs). The SWAT model is driven by meteorological data during the study period. Based on the measured runoff data from hydrological stations during the study period, initial ranges for sensitive parameters are set, and after multiple iterations of parameter tuning, SWAT model parameters suitable for the study watershed are obtained. The simulated values of intermediate physical variables and the directed confluence topology of sub-basins are collected from the calibrated SWAT model output.
[0008] The meteorological data, measured runoff data from hydrological stations, and intermediate physical variables output by the calibrated SWAT model during the study period were processed using the Min-Max Scaling method to obtain the feature variables for the machine learning algorithm. Two coupled model architectures were constructed: one is the SL model (SWAT+LSTM), which uses the gating mechanism of the LSTM network to capture the temporal dependencies of hydrological processes; the other is the SGL model (SWAT+GAT+LSTM), which introduces a GAT network on the basis of the SL model, generalizing sub-basins as directed graph nodes and confluence directions as directed connections between nodes. The GAT network's attention mechanism learns the differentiated contribution weights of upstream sub-basins to downstream confluence nodes, and then the processed features are input into the LSTM network to capture temporal features.
[0009] The data was divided into training and testing sets without shuffling the time series data. The training set was further split into training and validation subsets in a 9:1 ratio. A grid search method (based on the GridSearchCV tool) was used to traverse a preset range of candidate hyperparameters (including the number of neurons in the LSTM hidden layer, learning rate, dropout rate, batch size, GAT hidden layer dimension, and number of attention heads). The optimal combination of hyperparameters for the SL model and SGL model was determined with the maximum Nash efficiency coefficient (NSE) of the validation subset as the optimal objective.
[0010] Two coupled models are trained based on optimal hyperparameters. The training process adopts an early stopping strategy (training stops if the validation subset NSE does not improve for 10 consecutive epochs) and a learning rate adjustment strategy (the learning rate is halved if the validation loss does not decrease for 5 consecutive epochs, with a minimum learning rate of 0.00001). The loss function is the mean squared error (MSE), and the optimizer is Adam.
[0011] After training, the test set feature variables are input into the model to obtain simulated runoff. The actual runoff value is then restored using the Min-Max normalization inverse transform formula. The daily runoff simulation accuracy of the SWAT model, SL model, and SGL model is systematically evaluated using NSE, root mean square error (RMSE), relative root mean square error (RRMSE), and peak time error as evaluation indicators. The simulation effect of typical extreme floods during the study period is verified in particular. Daily runoff simulation data, extreme flood simulation process curves, and model performance evaluation reports are output.
[0012] Secondly, the present invention also provides a runoff simulation system that couples a SWAT model with a machine learning algorithm, comprising:
[0013] The data preprocessing module is used to collect and preprocess DEM data, land use data, soil type data, meteorological data, and measured runoff data;
[0014] The SWAT modeling module is used to build SWAT models in the research watershed and obtain intermediate physical variables of the hydrological model for coupling the model.
[0015] The coupled model building module is used to simulate runoff using machine learning algorithms with the intermediate physical variables of the hydrological model and the meteorological data as feature variables, while also considering the confluence relationship between sub-basins, to obtain coupled models SL and SGL.
[0016] The model output evaluation module is used to evaluate the role of constructing hydrological models and machine learning algorithms in improving the simulation effect of runoff in the research basin;
[0017] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the runoff simulation method of coupling physical mechanisms and spatiotemporal deep learning as described above.
[0018] This invention provides a runoff simulation method and system that couples the SWAT model with machine learning algorithms. By fully coupling the SWAT hydrological model's ability to simulate physical processes with the advantages of the GAT and LSTM machine learning algorithms in processing spatiotemporal data, and by using a grid search method to achieve the optimal configuration of the parameters of the coupled physical mechanism and spatiotemporal deep learning model, it can better simulate the actual runoff process. It has the characteristics of clear physical mechanism, scientific rationality, and close relevance to engineering practice. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this 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 some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is one of the flowcharts of a runoff simulation method that couples a hydrological model with a machine learning algorithm provided by the present invention;
[0021] Figure 2 This is the second flowchart of a runoff simulation method that couples a hydrological model with a machine learning algorithm provided by the present invention.
[0022] Figure 3 This is a schematic diagram of the structure of a runoff simulation method that couples a hydrological model with a machine learning algorithm, provided by the present invention.
[0023] Figure 4 These are simulation results of extreme floods using the hydrological model and coupled model provided by this invention during the research period;
[0024] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0026] To address the shortcomings of existing technologies, this invention proposes a runoff simulation model that fully couples the ability of hydrological models to simulate physical processes with the advantages of machine learning algorithms in processing spatiotemporal data.
[0027] Figure 1 This is one of the flowcharts illustrating a runoff simulation method that couples a hydrological model with a machine learning algorithm, as provided in an embodiment of the present invention. Figure 1 As shown, it includes:
[0028] Step 100: Collect and preprocess DEM digital elevation data, land use data, soil type data, meteorological data, and observed runoff data. This includes data quality control, Min-Max normalization, and other preprocessing operations. Complete the collection, quality control, and standardization of watershed spatial data, meteorological data, and measured runoff data to provide qualified input data for subsequent model construction.
[0029] Step 200: Input DEM data; SWAT automatically extracts sub-basins and runoff relationships between them. Input land use data, soil type data, and slope data to delineate hydrological response units (HRUs).
[0030] Step 300: Drive the SWAT model using meteorological data, and calibrate the SWAT model using measured runoff data. The daily-scale intermediate physical variables output by the model, the meteorological data, and the measured runoff data are then normalized using Min-Max.
[0031] Step 400: Using the daily-scale intermediate physical variables output by the model and the meteorological data as feature variables, construct SWAT+LSTM and SWAT+GAT+LSTM models. Learn the directional confluence weights of sub-basins using GAT, and capture the temporal dependence of hydrological processes using LSTM;
[0032] Step 500: Optimize the model hyperparameters using the grid search method to determine the optimal combination of LSTM hidden layer neurons, learning rate, GAT dimension, etc.
[0033] Step 600: Output the simulation results of daily runoff and extreme floods. Divide the dataset into training and test / validation sets, and complete the training and performance validation of the coupled model based on metrics such as NSE and RMSE.
[0034] Specifically, such as Figure 2 As shown, firstly, preprocessed digital elevation model (DEM) data, precipitation data from the China Surface Climate Daily Value Dataset V3.0, maximum temperature data, minimum temperature data, wind speed data, UMD global 1km land use type data, HWSD global 1km soil attribute data, and hydrological station runoff observation data were collected. The DEM elevation data was input into the SWAT model to obtain watershed boundary files and sub-watershed confluence relationships. Then, soil and land use data were input into the SWAT model to obtain hydrological response units. Using hydrological station runoff observation data as the target variable, the SUFI-2 algorithm was used to determine sensitive parameters, and the SCE-UA algorithm was used for parameter calibration to obtain the optimal parameter combination for the SWAT model. Subsequently, the SWAT model was run with the optimal parameter combination to obtain the simulation results for each sub-watershed. Next, the sub-watershed confluence relationships were used for GAT learning, and the simulated physical variables and meteorological data of the SWAT model were used as feature sets and input into the Long Short-Term Memory (LSTM) network model for training, constructing coupled models SL and SGL. The hyperparameters of the SL and SGL models were optimized using a grid search method to capture the confluence topology of the upstream and downstream watersheds and obtain the simulated flow values of the hydrological stations.
[0035] This invention constructs a SWAT model in the Hanjiang River basin to obtain simulated hydrological processes during the study period (2000-2014). The obtained SWAT model's physical processes and meteorological data are normalized and used as feature variables for the coupled SL and SGL models. The invention systematically evaluates the effect of introducing machine learning algorithms on improving runoff simulation capabilities, demonstrating scientific rationality and close relevance to engineering practice.
[0036] Based on the above embodiments, step 100 includes:
[0037] Collect and preprocess DEM (Digital Elevation Model) data, land use data, soil type data, meteorological data, and observed runoff data. This includes data quality control and Min-Max normalization. Complete the collection, quality control, and standardization of watershed spatial data, meteorological data, and measured runoff data to provide qualified input data for subsequent model construction.
[0038] Specifically, DEM data with a spatial resolution of 90 m was downloaded from the SRTMDEM dataset, based on the latitude and longitude range of the Han River basin (106°15′–114°20′ E, 30°10′–34°20′ N). The DEM data is divided into blocks according to latitude and longitude; these blocks within the basin are mosaicked into a whole for easier subsequent processing. SWAT requires all input rasters to use a uniform projected coordinate system, therefore, the raster data needs to be projected. Small defects in the data are removed by filling depressions in the surface rasters, preventing issues such as river channel interruptions that might occur when directly performing river network identification on unfilled DEM data.
[0039] The 2000 China land use remote sensing monitoring data was used as the land use data source. Data from relevant provinces in the watershed were downloaded and merged and projected in GIS. The land use classification of the soil data differs from the classification standard in SWAT, therefore, it is necessary to map the data to the types in SWAT. First, the data was merged into six major categories to reduce the number of categories. Then, an index table was created for each category corresponding to the land use type in SWAT: the first column, VALUE, is the serial number or name of each land use category in the original data, and the second column, LANDUSE, is the name of the corresponding land use category in the SWAT database. The completed index table was then imported into SWAT.
[0040] The World Soil Database (HWSD) was used as the data source for the soil database. After downloading, the data was projected. The attribute table was opened in GIS; the VALUE value corresponded to the MU_GLOBAL value in the HWSD database, and COUNT represented the number of rasters. Exporting this table yielded all soil types within the watershed. The VALUE field in the attribute table was read, and soil data from the entire watershed was extracted from the HWSD database accordingly, stored separately in an Excel file for further processing. The downloaded data typically contains many soil types and is large in volume, making subsequent processing and calculations difficult. Therefore, reclassification is usually performed first, merging some soils to reduce the number of types. After obtaining the HWSD soil database for the watershed, the soil name could be found based on the SU_SYM90 field in the database to obtain the grouping of each soil type. Each soil group was then merged into a category, and the soil with the largest proportion (most rasters) was selected as the representative of that soil group. The data of this soil type was then used to represent the soil data of that soil group. The entries in the SWAT soil database are not entirely identical to those in HWSD. While most of the required data can be found directly in HWSD, some parameters such as soil structure (TEXTURE), soil wet density (SOL_BD), effective water holding capacity of soil layer (SOL_AWC), and saturated hydraulic conductivity (SOL_K) still need to be calculated using SPAW software. Soil erodibility factor (USLE_K) needs to be calculated manually based on existing data. After all data calculations are complete, paste all entries into the SWAT project database, then create a soil type index table. This allows you to retrieve the newly created soil type data using SWAT.
[0041] The meteorological data is processed into the format required by SWAT, meaning that each type of meteorological observation data (precipitation, temperature, relative humidity, solar radiation, and wind speed data) for each station is stored in a separate file. The first line is the start date of the data, and each subsequent line contains consecutive measured data. The preprocessed meteorological data needs to be imported into the WEGN_user file in SWAT2012.mdb. After processing each type of meteorological data by station, an index table is created for the SWAT model to read. The index table has five columns: station ID, station name, latitude, longitude, and altitude. The station index table must be in the same folder as the measured data.
[0042] Based on the above embodiments, step 200 includes:
[0043] The DEM data was input into the SWAT model, with a minimum catchment area threshold of 500,000 Ha. The GIS tool "Watershed Delineation" calculated the watershed boundary, divided sub-basins, and calculated the confluence relationships between sub-basins based on the elevation data. A total of 16 sub-basins were obtained, with sub-basin 4 being the outlet sub-basin of the Baihe hydrological station control area. The land use data and soil type data were cropped according to the watershed boundary and input into the SWAT model, with two sets of slope data set. To prevent the hydrological response units from being too fragmented and affecting the model's efficiency, land use type area thresholds were set to 5%, soil type area thresholds to 10%, and slope grouping area thresholds to 10%. The model automatically completed the division of the hydrological response units of the watershed.
[0044] The hydrological response unit is the smallest computational unit in SWAT, and the physical constraint of the SWAT model is the water balance formula:
[0045]
[0046]
[0047] In the formula, This represents the change in soil moisture content over a time step. Surface runoff, This is the actual evaporation rate. Surface runoff, Lateral runoff, This refers to underground runoff. The total water production is expressed in mm.
[0048] Based on the above embodiments, step 300 includes:
[0049] The SWAT model was driven by meteorological data and calibrated using measured runoff data. The six diurnal intermediate physical variables output by the model (potential evapotranspiration PET, actual evapotranspiration ET, soil moisture content SW, surface runoff SURQ, interflow LATQ, and total water yield WYLD) were normalized using Min-Max methods along with the meteorological and measured runoff data.
[0050] Specifically, meteorological data was used to drive the SWAT model. The study period was divided into a rate-setting period (2003-2010) and a validation period (2011-2014). The Sequential Uncertainty Fitting version 2 (SUFI2) algorithm was used to screen sensitive parameters. Based on the measured runoff data, the initial range of parameters was set, and the SCE-UA composite evolutionary algorithm was used to obtain a set of optimal parameters applicable to the Hanjiang River basin, with the maximization of the Nash efficiency coefficient (NSE) during the rate-setting period as the objective function.
[0051] The SUFI-2 algorithm is a classic algorithm for sensitivity analysis and uncertainty quantification of hydrological model parameters. Its core design idea is to efficiently identify sensitive parameters that play a dominant role in the simulation results through a finite number of model runs, and to quantify the impact of parameter uncertainty on the simulation output. Its core principles include: based on statistical sampling theory, it extracts representative parameter combinations from a pre-defined parameter space using methods such as Latin hypercube sampling, covering key parameter ranges without traversing the entire space, significantly reducing computational costs; it introduces a sensitivity analysis mechanism, using indicators such as the correlation coefficient and uncertainty contribution of parameters and simulation results to screen out sensitive parameters that significantly affect the accuracy of runoff simulation, while constructing uncertainty ranges for the parameters to define reasonable ranges for subsequent parameter calibration, effectively avoiding the interference of the "different parameters having the same effect" problem on model accuracy. The core advantage of this algorithm lies in balancing parameter selection efficiency and uncertainty quantification capabilities, providing an accurate set of sensitive parameters for hydrological models without relying on a large number of iterations, laying the foundation for subsequent parameter optimization.
[0052] The SCE-UA algorithm is a global optimization algorithm based on the theories of natural selection and evolution. Its core objective is to efficiently search for the global optimum in a complex parameter space, overcoming the tendency of traditional optimization algorithms to get trapped in local optima. Its core principles include: dividing the parameter space into multiple independent "complexes," each containing several parameter samples; expanding the search range of the optimal solution through parallel searching across multiple complexes; implementing a survival-of-the-fittest mechanism within each complex through sample fitness ranking, and periodically performing a "shuffling" operation to break down information isolation between complexes and promote the global transfer of high-quality parameter information; and, based on the idea of the composite method, gradually approaching the global optimum region of the parameter space through evolutionary operations such as sample reflection, contraction, and expansion until the preset convergence condition is met. The algorithm's core advantages lie in its strong global search capability and fast convergence speed, effectively handling high-dimensional and nonlinear problems in hydrological model parameter optimization, ensuring that the obtained parameter combinations achieve the best fit between the model simulation results and the measured data.
[0053] Using the optimal parameter combination, the SWAT model was run to obtain simulated daily runoff values for the study period. Simultaneously, the calibrated SWAT model output daily-scale data files for six physical variables: potential evapotranspiration (PET), actual evapotranspiration (ET), soil moisture content (SW), surface runoff (SURQ), interflow (LATQ), and total water yield (WYLD), all in mm. The daily-scale data files for these six physical variables and the meteorological data were normalized using the Min-Max Scaling formula, mapping them to the [0,1] interval. The formula is as follows:
[0054]
[0055] In the formula, The variables are after normalization. The original data value of the variable. This represents the original global maximum data value of the variable. This represents the original global minimum data value of the variable. Data is read using the Python pandas library, and the physical variable data of 16 sub-basins are merged according to time series, then concatenated with meteorological data to form the original feature dataset.
[0056] Based on the above embodiments, step 400 includes:
[0057] Using the six diurnal intermediate physical variables output by the model and the meteorological data as feature variables, SWAT+LSTM and SWAT+GAT+LSTM models were constructed. GAT was used to learn the directional confluence weights of sub-basins, and LSTM was used to capture the temporal dependence of hydrological processes.
[0058] Specifically, following the principle of not disrupting the time series, the period from 2003 to 2010 (2920 time steps) was divided into the training set and the period from 2011 to 2014 (1463 time steps) was divided into the test set. The training set was further divided into a training subset and a validation subset in a 9:1 ratio.
[0059] While inheriting the time-series processing capabilities of Recurrent Neural Networks (RNNs), LSTM solves the problems of "vanishing gradients" and "exploding gradients" through a gating mechanism.
[0060] The forgetting gate determines which information in a cell's state needs to be forgotten.
[0061]
[0062] The input gate determines which information in the current cell needs to be updated.
[0063]
[0064]
[0065] (3) Cell state is updated through the forget gate and the input gate.
[0066]
[0067] (4) The output gate determines the hidden state of the final output based on the updated cell state.
[0068]
[0069]
[0070]
[0071] In the formula, This is the input information for this moment. , , , These are the output information and memory information for the current moment and the previous moment, respectively. , , , and , , , Update the weights and biases of input gate i, forget gate f, output gate o, and cell state g. For activation function, It is the hyperbolic tangent activation function.
[0072] It is the key carrier for LSTM to achieve long-term temporal dependency modeling, representing the entry of neurons. "Memory" at a given moment, i.e., neural network pairs This study combines all input information up to the specified time point. The hyperbolic tangent activation function is used in this study. Updating cell states can effectively alleviate the gradient vanishing problem and meet the numerical stability requirements of LSTM gating mechanisms. Meanwhile... The gradient is large near the center, and the model converges quickly.
[0073] Based on the PyTorch 1.12 framework, the input layer receives a standardized feature dataset; the LSTM layer has two hidden layers with Tanh activation function and a Dropout rate of 0.1, and a BatchNorm1d layer is added after the output of the first layer; the output layer is a fully connected layer, mapped to a single output value, with Sigmoid activation function; the loss function is MSE, the optimizer is Adam, the initial learning rate is 0.001, and the weight decay is 0.0001.
[0074] Graph Attention Networks (GATs) with adapted directed graph structures can accurately characterize the differentiated contributions of different upstream sub-basins to downstream confluence. The attention coefficients, normalized attention weights, and node feature update formulas for nodes i and j are as follows:
[0075]
[0076]
[0077]
[0078] In the formula, The function is a normalization function that ensures the sum of the attention weights of all neighboring nodes to the central node is 1. This is the activation function, used to introduce non-linear features and improve the model's ability to fit complex features. Updated node features. It is the result of a weighted sum of the neighbor node features mapped by a weight matrix and their corresponding attention weights, fully integrating the key feature information of the central node and neighbor nodes. Through the dynamic allocation of attention weights, differentiated attention is achieved to neighbor nodes with different contributions.
[0079] Based on the above embodiments, step 500 includes:
[0080] The grid search method was used to optimize the model hyperparameters and determine the optimal combination of LSTM hidden layer neurons, learning rate, GAT dimension, etc.
[0081] Specifically, the search process is based on scikit-learn's GridSearchCV tool, combined with PyTorch model wrapper classes, to verify that maximizing the subset NSE is the optimal goal, and to traverse hyperparameter combinations.
[0082] Based on the above embodiments, step 600 includes:
[0083] Output the simulation results of daily runoff and extreme floods. The training / rate-up period was from 2003 to 2010, and the testing / validation period was from 2011 to 2014. The training and performance validation of the coupled model were completed based on indicators such as NSE and RMSE.
[0084] Specifically, the SWAT model simulates the runoff process in step 300, and the simulated runoff values of the coupled models SL and SGL need to be restored to the actual runoff volume using the inverse transformation formula:
[0085]
[0086] This study selected the four floods with the largest daily simulated runoff and peak flow during the study period (2000-2014) (flood numbers 20030831, 20051002, 20110802, and 20110918) as evaluation objects. NSE, RMSE, RRMSE, and flood peak occurrence time error were used as evaluation indicators. The system systematically evaluated the role of introducing machine learning algorithms, particularly watershed confluence relationships, in improving the accuracy of runoff simulation. The evaluation indicator formulas are as follows:
[0087]
[0088]
[0089]
[0090] In the formula, This represents the actual observed runoff at the i-th time step. Let N represent the simulated runoff at the i-th time step, and N be the total number of time steps in the study period.
[0091] The simulation results of SWAT and the coupled models SL and SGL for four extreme floods during the study period are as follows: Figure 4 As shown.
[0092] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540. The processor 510, communication interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute runoff simulation coupled with a SWAT model and a machine learning algorithm. This method includes: collecting and preprocessing meteorological data, measured runoff data, DEM digital elevation data, land use data, and soil type data; inputting the preprocessed DEM digital elevation data into the SWAT model; extracting the study watershed boundary vector file; dividing the watershed into sub-watersheds; and calculating the confluence relationships between sub-watersheds. The preprocessed land use data and preprocessed soil type data, after being cropped from the study watershed boundary vector file, are input together with slope data into the SWAT model to divide hydrological response units. The meteorological data was used to drive the SWAT model, with a calibration period and a test period. The SWAT model was calibrated using measured daily runoff data from the hydrological stations to obtain the optimal parameter combination suitable for the study watershed. Intermediate physical variables and simulated daily runoff processes from the SWAT model output were obtained. Peak flow was used as the evaluation index to obtain simulated typical flood processes during the study period. The meteorological data and intermediate physical variables from the SWAT model output were used as machine learning feature variables, and the measured daily runoff data from the hydrological stations were used as target variables. GAT was used to learn the confluence relationships between the sub-watersheds and adaptively allocate weights. LSTM was used to capture the temporal dependence of hydrological processes. The SL (SWAT+LSTM) model and the SGL (SWAT+GAT+LSTM) model were constructed. The data was divided into training and test sets. The hyperparameters of the SL and SGL models were determined using a grid search method. The daily runoff processes output by the coupled models SL and SGL constructed in the study watershed, and the simulated typical flood processes of the coupled models during the study period were obtained. The Nash efficiency coefficient (NSE), root mean square error (RMSE), and relative root mean square error (RRMSE) were used as evaluation indicators to assess the runoff simulation accuracy of the hydrological model and coupled model constructed in the study watershed.
[0093] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for simulating runoff by coupling a SWAT model with a machine learning algorithm, characterized in that, include: Collect and preprocess meteorological data, measured daily runoff data from hydrological stations, DEM digital elevation data, land use data, and soil type data; The preprocessed DEM digital elevation data is input into the Soil and Water Assessment Tool (SWAT) model to automatically extract the watershed boundary vector file, divide the watershed into sub-watersheds, and calculate the runoff relationships between sub-watersheds. The preprocessed land use data and preprocessed soil type data, after being cropped from the watershed boundary vector file, are input into the SWAT model along with the slope data to complete the division of Hydrological Response Units (HRUs). The meteorological data was used to drive the SWAT model built in the study area. The model was divided into a calibration period and a verification period. The SWAT model was calibrated using the measured daily runoff data of the hydrological stations to obtain the optimal parameter combination suitable for the study watershed. Obtain intermediate physical variables from the SWAT model output and simulate daily runoff processes. Use peak flow as the evaluation index to obtain simulated typical flood processes during the study period; The meteorological data and intermediate physical variables output by the SWAT model are used as machine learning feature variables, and the measured daily runoff data from the hydrological stations are used as target variables. GAT learns the confluence relationships between the sub-basins and adaptively allocates weights. LSTM is used to capture the temporal dependencies of hydrological processes. The SL (SWAT+LSTM) model and the SGL (SWAT+GAT+LSTM) model are constructed. The data is divided into training and testing sets. The hyperparameters of the SL and SGL models are determined using a grid search method. The daily runoff processes output by the coupled models SL and SGL constructed in the study watershed are obtained, as well as the simulated typical flood processes of the coupled models during the study period. The Nash efficiency coefficient (NSE), root mean square error (RMSE), and relative root mean square error (RRMSE) were used as evaluation indicators to assess the runoff simulation accuracy of the hydrological model and coupled model constructed in the study watershed.
2. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, Collect and preprocess meteorological data, measured daily runoff data from hydrological stations, DEM digital elevation data, land use data, and soil type data, including: The DEM (Digital Elevation Model) data uses the SRTMDEM dataset with a spatial resolution of 90m×90m, and has undergone preprocessing including mosaicking, projection, and depression filling. The land use data is from the China Land Use Remote Sensing Monitoring Dataset, with a resolution of 30m×30m, and has undergone preprocessing including merging, projection, cropping, reclassification, and index table construction. The soil data comes from the HWSD v1.2 database with a resolution of 1000m×1000m, and has undergone preprocessing including projection, cropping, reclassification, parameter supplementation calculation, and database import. The meteorological data comes from the China Surface Climate Data Daily Value Dataset V3.0, containing daily precipitation, temperature, relative humidity, solar radiation, and wind speed during the study period, and has undergone preprocessing including format standardization, quality control, and index table construction. The measured daily runoff data from hydrological stations comes from the Hydrological Yearbook of the People's Republic of China, and has undergone outlier correction preprocessing.
3. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, The preprocessed DEM digital elevation data is input into the SWAT model, which automatically extracts the watershed boundary vector file, divides the watershed into sub-watersheds, and calculates the runoff relationships between sub-watersheds. The preprocessed land use data and preprocessed soil type data, after being cropped from the watershed boundary vector file, are input into the SWAT model along with slope data to complete the division of Hydrological Response Units (HRUs), including: Input DEM data and set a minimum catchment area threshold. Use the "Watershed Delineation" tool to extract the river network, complete the sub-basin division of the study watershed, and clarify the upstream inflow relationships of the sub-basins. Divide the watershed slope into two groups. Combine the preprocessed land use data and soil data, set area thresholds for land use type, soil type, and slope grouping, and obtain the hydrological response units.
4. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, The meteorological data was used to drive the SWAT model, which was divided into a calibration period and a verification period. The SWAT model was calibrated using the measured daily runoff data from the hydrological stations to obtain the optimal parameter combination suitable for the study watershed, including: First, the SUFI-2 algorithm was used to screen sensitive parameters for the study watershed. An initial parameter range was set, and the SCE-UA composite evolutionary algorithm was employed, with the rate-periodic NSE maximization as the objective function and a convergence threshold of 0.001, to obtain a set of optimal parameters for the SWAT model in the study watershed.
5. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, Obtain intermediate physical variables from the SWAT model output and simulate daily runoff processes. Using peak flow as the evaluation index, obtain simulated typical flood processes during the study period, including: Considering physical interpretability, a suitable SWAT model is selected to output the combination of intermediate physical variables, with a daily output time resolution. Based on the peak flow rate, typical flood processes within the study period are extracted from the measured daily runoff data. The extracted and validated SWAT model simulates the runoff rate, peak type, and peak occurrence time of the flood process.
6. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, The meteorological data and intermediate physical variables output by the SWAT model are used as machine learning feature variables, and the measured daily runoff data from the hydrological stations are used as target variables. GAT learns the confluence relationships between the sub-basins and adaptively assigns weights. LSTM is used to capture the temporal dependencies of hydrological processes. The SL (SWAT+LSTM) model and the SGL (SWAT+GAT+LSTM) model are constructed, including: The feature and target variables used in ML were normalized to the [0,1] interval using Min-Max Scaling. The training and test sets were divided without shuffling the time series data. The training set was further divided into training and validation subsets in a 9:1 ratio. The SL model was built on the PyTorch framework and included an input layer, two LSTM hidden layers, a BatchNorm1d layer, and an output layer. The loss function was MSE, and the optimizer was Adam. The SGL model introduced a GAT layer on top of the SL model, generalizing the sub-basins as directed graph nodes, with the confluence direction being the directed connection between nodes. The GAT layer was used to calculate the differentiated contribution weights of the upstream sub-basins.
7. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, The data is divided into training and testing sets. The hyperparameters of the SL and SGL models are determined using a grid search method. The daily runoff processes output by the coupled models SL and SGL constructed in the study watershed are obtained, along with the simulated typical flood processes of the coupled models during the study period, including: The candidate hyperparameters included the number of neurons in the LSTM hidden layer [32, 64, 128], learning rate [0.0001, 0.001, 0.01], dropout rate [0.1, 0.2, 0.3], batch size [16, 32, 64], GAT hidden layer dimension [32, 64, 128], and number of GAT attention heads [4, 8, 16]. The GridSearchCV tool was used to iterate through the hyperparameter combinations to verify that maximizing the subset NSE was the optimal objective, thus determining the optimal hyperparameter combination. Early stopping and learning rate adjustment strategies were employed during model training. After training, daily runoff simulation values and simulation data for four floods were output.
8. The runoff simulation model coupled with the SWAT model and machine learning algorithm according to claim 1, characterized in that, The appropriate hydrological evaluation indices were selected to assess the simulation capabilities of the hydrological model SWAT and the coupled models SL and SGL for daily runoff processes and typical flood processes in the Hanjiang River basin, including: NSE, RMSE, RRMSE, and peak time error were used as hydrological evaluation indicators. In the formula, This represents the actual observed runoff at the i-th time step. Let N represent the simulated runoff at the i-th time step, and N be the total number of time steps in the study period.
9. A runoff simulation system coupling a SWAT model and a machine learning algorithm, characterized in that, include: The data preprocessing module is used to collect and preprocess DEM data, land use data, soil type data, meteorological data, and measured runoff data; The SWAT modeling module is used to build SWAT models in the research watershed and obtain intermediate physical variables of the hydrological model for coupling the model. The coupled model building module is used to simulate runoff using machine learning algorithms with the intermediate physical variables of the hydrological model and the meteorological data as feature variables, while also considering the confluence relationship between sub-basins, to obtain coupled models SL and SGL. The model output evaluation module is used to evaluate the role of constructing hydrological models and machine learning algorithms in improving the simulation effect of watershed runoff.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the runoff simulation method that couples the physical mechanism of the SWAT model with the machine learning algorithm as described in any one of claims 1 to 8.