A Soil and Water Monitoring Method Based on Topographic Factors and Upstream-Downstream Confluence Relationship
By combining topographic factors and upstream-downstream confluence relationships in water and soil monitoring methods, the problem of missing topographic factors in traditional methods has been solved, enabling efficient and accurate risk assessment of soil erosion in complex topographic watersheds.
Patent Information
- Application Number
- CN202611522919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-29
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional soil and water conservation monitoring methods fail to fully consider topographic factors and upstream-downstream confluence relationships, resulting in assessment results losing practical reference value in complex topographic watersheds. This is especially true in hilly and mountainous areas, where it is difficult to achieve comprehensive and timely monitoring of large-area watersheds.
A water and soil monitoring method based on topographic factors and upstream-downstream confluence relationships was adopted. Through comprehensive analysis of DEM data, remote sensing image data, and soil sampling data, a rainfall erosion field, a soil erodibility field, and topographic factor extraction and confluence relationships were constructed. The confluence path chain was tracked by combining the D8 unidirectional flow algorithm, a fused feature vector was generated, and a random forest classifier was used for risk assessment.
It improves the accuracy of soil erosion risk assessment, can truly reflect the physical law that steep and long slopes are more susceptible to erosion, and enhances the accuracy and comprehensiveness of monitoring results.
Smart Images

Figure CN123116718A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of soil and water monitoring, specifically relating to a soil and water monitoring method based on topographic factors and upstream-downstream confluence relationships. Background Technology
[0002] To prevent soil erosion risks, ensure project safety, and maintain watershed ecological stability, real-time soil and water monitoring is necessary. Traditional soil and water conservation monitoring methods mainly rely on field surveys and manual measurements, which have limited monitoring scope and are difficult to comprehensively and timely monitor large watersheds. Therefore, existing technologies increasingly employ remote sensing for real-time monitoring and risk assessment through gridded independent assessment strategies. However, in actual monitoring and assessment processes, only a limited number of factors such as rainfall erosivity and soil erodibility are generally considered, without taking into account core topographic factors that determine the intensity of soil erosion on slopes, such as slope gradient, slope length, and catchment area. Especially in hilly and mountainous areas, even with identical rainfall and soil conditions, the soil erosion risk of a 30° steep slope can differ by tens of times from that of a 3° gentle slope. The lack of topographic factors may render the assessment results essentially worthless in complex topographic watersheds. Summary of the Invention
[0003] In view of the shortcomings of the above-mentioned existing technologies, the present invention provides a water and soil monitoring method based on topographic factors and upstream and downstream confluence relationships, which fully considers topographic factors and the impact of upstream and downstream confluence, and improves the accuracy of monitoring and risk assessment.
[0004] In order to achieve the objective of this invention, the following solution is proposed: A method for monitoring soil and water conservation based on topographic factors and upstream-downstream runoff relationships, comprising the following steps: S01. Collect raw data of the target watershed, including: DEM data, remote sensing image data, soil sampling point data and hourly rainfall data; S02. Data Processing: Unify all raw data into the same coordinate system and divide it into grid cells. Each grid cell records its spatial coordinates, elevation values, multi-band reflectance values, soil sampling attributes, and rainfall intensity time series to generate a basic database. S03. Construction of Rainfall Erosion Field: The rainfall intensity time series of each grid cell is divided into multiple independent rainfall events. The squares of all hourly rainfall intensities of the independent rainfall events within 30 days of each grid cell are summed to obtain the time-period cumulative rainfall erosion index of each grid cell. The time-period cumulative rainfall erosion index of all grid cells is divided into three rainfall dynamic impact coefficients of 0.3, 0.65, and 1.0 according to the quantile threshold. S04. Construction of Soil Erosion Field: Based on soil sampling attributes, the inverse distance weighted interpolation method is used to obtain the interpolation results of all grid cells. According to the interpolation results, the grid cells are divided into three soil erosion state levels, and a soil structure stability index is formed for each grid cell. S05. Topographic factor extraction and confluence relationship construction: Based on the elevation value, obtain the slope value and slope length value of each grid cell, and combine the slope value and slope length value to generate the LS level of the grid cell. Obtain the flow direction code of each grid cell through the D8 single flow direction algorithm, establish the first-level upstream grid list of each grid cell based on the flow direction code, and track all confluence path chains in the entire watershed, and record the upstream source level of each grid cell. S06. Obtain upstream confluence push value: Convert the LS level of each grid cell into the topographic risk base of that grid cell, trace the risk contribution of each grid cell upstream along the confluence path chain and sum them all to generate the upstream confluence push value of each grid cell, and record the number and contribution percentage of the top three upstream grid cells with the largest contribution. The risk contribution is equal to the sum of the topographic risk base, the dynamic impact coefficient of rainfall and the soil erodibility status level and multiplied by the distance reduction factor. S07. Extract the spatial coordinates of each grid cell from the basic database, and arrange and merge the rainfall dynamic impact coefficient, soil structure stability index, LS level, upstream source level and upstream confluence push value of each grid cell in sequence to form a fused feature vector. S08. Risk Assessment: Input the fused feature vector into the pre-trained random forest classifier and infer to obtain the probability values of the three categories of low risk, medium risk and high risk for each grid cell.
[0005] Further, S02 includes the following steps: S021. Convert the raw data to the geodetic coordinate system and divide the target watershed space into multiple grids. Assign a unique number to each grid and record the coordinates of the center point and the four boundary coordinates of each grid as the spatial location identifier of the grid. S022. Crop the remote sensing image data according to the grid and obtain the multi-band reflectance value of each grid; S023. Extract elevation values from the DEM data by grid, and obtain the center point elevation and the average elevation within each grid. S024. Spatially overlay the coordinates of the soil sampling points with the grid, obtain the unique number of the grid corresponding to each coordinate, and assign the soil texture type and soil organic matter content to the corresponding grid. S025. Spatialize the rainfall data by grid and generate hourly rainfall intensity time series for each grid.
[0006] Furthermore, S03 includes the following steps: S031. Divide the rainfall intensity time series of each grid cell into multiple independent rainfall events according to the preset continuous rainfall intensity, and record the start time, end time and maximum hourly rainfall intensity of each independent rainfall event within the time period; S032. Sum the squares of all hourly rainfall intensity values within an independent rainfall event to obtain the rainfall erosivity contribution value of that independent rainfall event; S033. Sum the erosivity contribution values of all rainfall events that occurred within the last 30 days in a grid cell to obtain the time-based cumulative rainfall erosivity index of that grid cell. S034. Statistically calculate the cumulative rainfall erosivity index for all grid units in the entire watershed and convert it into a dynamic rainfall impact coefficient. The value is 0.3 for those below the 30th percentile, 0.65 for those between the 30th and 70th percentiles, and 1.0 for those above the 70th percentile.
[0007] Furthermore, S04 includes the following steps: S041. Convert the soil texture type of all grid cells into the first to fourth coding values, and convert the soil organic matter content value into the first to fourth grade coding values according to the preset grading threshold to obtain the soil texture code and organic matter grading code. S042. The soil texture code and organic matter classification code of each grid unit are spliced together to form a two-digit comprehensive code for soil erodibility. S043. Use the inverse distance weighted interpolation method to obtain the interpolation results for all grid cells; S044. Divide the interpolation results of all grid cells into three soil erodibility status levels; S045. Extract the interpolation results of all grid cells within a 5×5 window surrounding each grid cell, calculate the variance of the difference results and normalize them, and use them as the soil structure stability index of that grid cell.
[0008] Furthermore, S05 includes the following steps: S051. Using the slope tool and cumulative slope length tool, and based on the elevation value, obtain the slope value and slope length value of each grid cell, divide the slope value into three levels, and divide the slope length value into two levels; S052. Combine the slope grade and slope length grade of each grid cell to generate a 6-level combination code, and simplify it into three LS grades, with each grid cell corresponding to one LS grade. S053. Obtain the water flow direction of each grid cell using the D8 single-flow direction algorithm and generate a flow direction code; S054. Traverse all grid cells in the entire watershed, record all other grid cells whose flow direction codes point to the current grid cell, and build a list of first-level upstream grid cells for the current grid cell. S055. Starting from the round-headed grid cell in the first-level upstream grid list, proceed downstream level by level along the flow direction code until the watershed outlet or boundary is reached. Record all the grids passed through in sequence as a confluence path chain, and record the upstream source level of each grid cell in the confluence path chain.
[0009] Furthermore, the tracing termination condition for the confluence path chain in S055 is: the elevation value of the grid cell reached along the flow direction is lower than the preset watershed outlet elevation threshold, or the grid cell is located on the target watershed boundary and there is no downstream receiving grid cell.
[0010] Furthermore, in S06, when the LS level is the highest, the terrain risk base score is 70 points; when the LS level is the second highest, the terrain risk base score is 45 points; and when the LS level is the lowest, the terrain risk base score is 20 points.
[0011] Furthermore, S07 includes the following steps: S081. Input the fused feature vector into a pre-trained random forest classifier. The random forest classifier consists of multiple decision trees. Each decision tree outputs the class distribution of its leaf node to the fused feature vector. S082. Average the category distributions of all decision trees for each category to obtain the probability value of each grid cell belonging to the three categories of low risk, medium risk, and high risk. The sum of the three probability values is equal to 1.
[0012] Furthermore, the training method for the random forest classifier is as follows: Collect the fused feature vectors of each grid cell in historical time periods and the risk level labels confirmed by on-site inspections during the same period as training samples; Multiple training subsets are randomly selected with replacement from the training samples, and a decision tree is trained independently for each training subset. During training, at each node split point, a subset of features are randomly selected from all features as candidate split features, and the splitting method that maximizes the class purity of the child node samples is chosen. After training is complete, each leaf node records the class distribution of the training samples that fall into that node.
[0013] The beneficial effects of this invention are as follows: Slope values and flow direction codes are obtained based on elevation values, thereby generating LS levels and confluence path chains. Topographic factors are no longer excluded from risk assessment but are integrated throughout the entire process of topographic risk baseline calculation and upstream confluence push value calculation, enabling the assessment results to truly reflect the physical law that steep and long slopes are more prone to erosion, thus making the results more accurate. A first-level upstream grid list is established for each grid unit using the D8 single-flow direction algorithm, and the entire watershed confluence path chain is traced. Then, by tracing upstream along the path, the topographic risk, rainfall impact, and soil erodibility of the upstream grids are progressively accumulated into the upstream confluence push value, fully reflecting the impact of upstream water and sediment, further improving the accuracy of monitoring and assessment results. Attached Figure Description
[0014] Figure 1 This is a flowchart of the soil and water monitoring method according to an embodiment of this application. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the implementation methods of the present invention will be described in detail below with reference to the accompanying drawings. However, the embodiments described in this invention are only some embodiments of the present invention, and not all embodiments.
[0016] This application provides a method for soil and water monitoring based on topographic factors and upstream-downstream confluence relationships, such as... Figure 1 As shown, the steps include: S01. Collect raw data of the target watershed, including: DEM data, remote sensing image data, soil sampling point data and hourly rainfall data.
[0017] Specifically, soil sampling data includes soil texture type (sandy loam, loam, clay loam, clay) and soil organic matter content. Hourly rainfall data usually needs to include data from no less than 10 meteorological stations within and around the target watershed, covering the most recent five consecutive complete hydrological years.
[0018] S02. Data processing, including the following steps: S021. Convert the raw data to the geodetic coordinate system and divide the target watershed space into multiple grid units. Assign a unique number to each grid unit and record the coordinates of the center point and the four boundary coordinates of each grid unit as the spatial location identifier of the grid unit. S022. Crop the remote sensing image data according to the grid and obtain the multi-band reflectance value of each grid cell; S023. Extract elevation values from the DEM data by grid cell to obtain the center point elevation and average elevation within each grid cell. S024. Spatially overlay the coordinates of the soil sampling points with the grid cells to obtain the unique number of the grid cell corresponding to each coordinate, and assign the soil texture type and soil organic matter content to the corresponding grid. S025. Spatialize the rainfall data by grid, and generate hourly rainfall intensity time series for each grid. S026. Associate the spatial location identifier, spatial location identifier, center point elevation, average elevation within the grid, soil texture type, soil organic matter content, and hourly rainfall intensity time series with the grid cells to generate a basic database.
[0019] S03. Construction of the rainfall erosion force field, including the following steps: S031. Divide the rainfall intensity time series of each grid cell into multiple independent rainfall events according to the preset continuous rainfall intensity. For a period of continuous rainfall intensity greater than 0.5 mm / h, it is classified as an independent rainfall event. When the rainfall intensity is less than 0.5 mm / h for 6 consecutive hours, it is considered to end the event. Record the start time, end time and maximum hourly rainfall intensity within the period of each independent rainfall event. S032. For each isolated rainfall event, sum the squares of all hourly rainfall intensity values within that independent rainfall event to obtain the rainfall erosivity contribution value of that independent rainfall event. The larger the event erosivity contribution value, the stronger the splashing and transport capacity of the independent rainfall event on the surface soil particles. S033. Sum the erosivity contribution values of all rainfall events that occurred within the last 30 days in a grid cell to obtain the time-based cumulative rainfall erosivity index of that grid cell. S034. Statistically calculate the cumulative rainfall erosivity index for all grid units across the entire watershed. Use the 30th and 70th percentiles as two dividing thresholds. Compare the index value of each grid unit with these two thresholds to classify it into three levels: Level 1 (low erosivity) for index values below the 30th percentile, Level 2 (medium erosivity) for index values between the 30th and 70th percentiles, and Level 3 (high erosivity) for index values above the 70th percentile. Each grid unit obtains a rainfall erosivity state level. Then, convert the rainfall erosivity state level of each grid unit into a rainfall dynamic impact coefficient between 0 and 1, with Level 1 corresponding to 0.3, Level 2 to 0.65, and Level 3 to 1.0. This coefficient represents the impact intensity of rainfall on the soil during the current period; the larger the value, the stronger the ability of rainfall to induce soil erosion.
[0020] S04. Construction of Soil Erosion Field: Based on soil sampling attributes, the inverse distance weighted interpolation method is used to obtain the interpolation results of all grid cells. According to the interpolation results, the grid cells are divided into three soil erosion state levels, and a soil structure stability index is formed for each grid cell. Specifically, S04 includes the following steps: S041. Convert the soil texture type of all grid cells into the first to fourth coding values: sandy loam is coded as 1, loam as 2, clay loam as 3, and clay as 4. Convert the soil organic matter content value into the first to fourth grade coding values according to the preset grading threshold: less than 10g / kg is coded as 1, between 10 and 20g / kg is coded as 2, between 20 and 30g / kg is coded as 3, and greater than 30g / kg is coded as 4. Obtain the soil texture code and organic matter grading code. S042. The soil texture code and organic matter classification code of each grid unit are combined to form a two-digit comprehensive code for soil erodibility. For example, the comprehensive code of a grid unit with a texture code of 3 (clay loam) and an organic matter classification code of 2 (10~20g / kg) is 32. The lower the code value, the less likely the soil is to be eroded, and the higher the value, the more likely the soil is to be washed away by rainfall. S043. Use the inverse distance weighted interpolation method to obtain the interpolation results of all grid cells. For each grid cell, find all sampling points within a certain radius (e.g., 5 kilometers) around it, assign weights according to distance (the closer the distance, the greater the weight), and calculate the weighted average to obtain the soil erodibility interpolation result of the grid. The interpolation result is a continuous value with a value range between 11 and 44. S044. Divide the interpolation results of all grid cells into three soil erodibility status levels: 11~22 is the first segment, 23~33 is the second segment, and 34~44 is the third segment, corresponding to three status levels: level 1 (low erodibility), level 2 (medium erodibility), and level 3 (high erodibility). Each grid cell obtains a soil erodibility status level. S045. Extract the interpolation results of all grid cells within a 5×5 window surrounding each grid cell, calculate the variance of the difference results. The larger the variance, the more drastic the spatial variation of soil properties in the area and the more unstable the soil structure. Take the reciprocal of the calculated variance and normalize it to compress the value to 0-1, which is used as the soil structure stability index of the grid cell. The closer the index is to 1, the more stable the soil structure and the stronger the erosion resistance. The closer it is to 0, the more fragile the soil structure.
[0021] S05. Topographic factor extraction and confluence relationship construction, including the following steps: S051. Using the slope tool and cumulative slope length tool, and based on the elevation value, obtain the slope value and slope length value of each grid cell. Divide the slope value into three levels and the slope length value into two levels. For slope values less than 8 degrees, it is a gentle slope (level 1); for slope values greater than or equal to 8 degrees and less than 20 degrees, it is a medium slope (level 2); for slope values greater than or equal to 20 degrees, it is a steep slope (level 3). For slope length values less than 80 meters, it is a short slope (level 1); for slope length values greater than or equal to 80 meters, it is a long slope (level 2). Record one slope level and one slope length level for each grid cell. S052. Combine the slope grade and slope length grade of each grid cell to generate a 6-level combination code. For example, slope grade 2 and slope length grade 1 correspond to one code value. Simplify these 6-level combination codes into three LS grades: LS grade 1 (weak terrain amplification effect), LS grade 2 (medium terrain amplification effect), and LS grade 3 (strong terrain amplification effect). Each grid cell corresponds to one LS grade. S053. Obtain the water flow direction of each grid cell through the D8 single flow direction algorithm and generate a flow direction code. The D8 single flow direction algorithm can compare the elevation of the current grid cell with the elevation of its eight neighboring grid cells and select the direction with the fastest elevation drop and the steepest slope as the flow direction, generating flow direction codes 1 to 8 (representing the eight directions of east, southeast, south, southwest, west, northwest, north, and northeast respectively). S054. Traverse all grid cells in the entire watershed, record all other grid cells whose flow direction codes point to the current grid cell, and build a list of first-level upstream grid cells for the current grid cell. S055. Starting from the round-headed grid cell in the first-level upstream grid list, proceed downstream step by step along the flow direction code until the watershed outlet or boundary is reached. When the elevation value of the grid cell reached along the flow direction code is lower than the preset watershed outlet elevation threshold, or when the grid cell is already located on the target watershed boundary and there is no downstream receiving grid cell, stop tracking, record all the grids passed in sequence as a confluence path chain, and record the upstream source level of each grid cell in the confluence path chain, that is, the number of steps required to trace back to the source from the grid cell.
[0022] S06. Obtain upstream confluence push value: Convert the LS level of each grid cell into the terrain risk base of that grid cell. When the LS level is the highest, the terrain risk base score is 70 points. When the LS level is the second highest, the terrain risk base score is 45 points. When the LS level is the lowest, the terrain risk base score is 20 points. Generate the terrain risk base value, which ranges from 20 to 70. Then, trace the risk contribution of each grid cell upstream along the confluence path chain and sum them all to generate the upstream confluence push value of each grid cell. Record the numbers and contribution percentages of the three upstream grid cells with the largest contributions as the basis for subsequent risk analysis.
[0023] The risk contribution is equal to the sum of the topographic risk base, the dynamic impact coefficient of rainfall, and the soil erodibility status level, multiplied by the distance reduction factor. The distance reduction factor is determined according to the path level between the upstream grid and the current grid: the reduction factor is 1.0 for level 1, 0.75 for level 2, 0.55 for level 3, 0.40 for level 4, and decreases to 0.10 for levels 5 to 10.
[0024] Example: For the current grid cell A, perform the following backtracking accumulation operation: Using the list of first-level upstream grids of grid cell A in S05, find all first-level upstream grid cells B of A (denoted as Level 1). For each upstream grid B in Level 1, find all upstream grids of B (denoted as Level 2) through the list of first-level upstream grids of B, and so on, tracing back up to a maximum of 10 levels. For each upstream grid U traced back, calculate its risk contribution to the current grid A. The calculation formula is: Contribution = (Topographic risk baseline of grid U + Rainfall dynamic impact coefficient of grid U + Soil erodibility state level coefficient of grid U) × Distance reduction coefficient, where the soil erodibility state level coefficient is: 0.5 for Level 1, 0.8 for Level 2, and 1.0 for Level 3. Add up the contributions of all upstream grids to obtain the upstream confluence push value of grid A, which ranges from 0 to 100.
[0025] S07. Extract the spatial coordinates of each grid cell from the basic database, and arrange and merge the rainfall dynamic impact coefficient, soil structure stability index, LS level, upstream source level and upstream confluence push value of each grid cell in sequence to form a fused feature vector. S08. Risk Assessment: Input the fused feature vector into the pre-trained random forest classifier and infer to obtain the probability values of the three categories of low risk, medium risk and high risk for each grid cell.
[0026] Specifically, S08 includes the following steps: S081. Input the fused feature vector into a pre-trained random forest classifier. The random forest classifier consists of multiple decision trees. Each decision tree outputs the class distribution of its leaf node to the fused feature vector. S082. Average the category distributions of all decision trees for each category to obtain the probability value of each grid cell belonging to the three categories of low risk, medium risk, and high risk. The sum of the three probability values is equal to 1.
[0027] Specifically, the training method for the random forest classifier is as follows: Collect the fused feature vectors of each grid cell in historical time periods and the risk level labels confirmed by on-site inspections during the same period as training samples; Multiple training subsets are randomly selected with replacement from the training samples, and a decision tree is trained independently for each training subset. During training, at each node split point, a subset of features are randomly selected from all features as candidate split features, and the splitting method that maximizes the class purity of the child node samples is chosen. After training is complete, each leaf node records the class distribution of the training samples that fall into that node.
[0028] The above are merely preferred embodiments of the present invention and are not intended to be the only or limiting of the present invention. Those skilled in the art should understand that various changes or equivalent substitutions made to the present invention without departing from its scope are all within the protection scope of the present invention.
Claims
1. A method for monitoring soil and water conservation based on topographic factors and upstream-downstream runoff relationships, characterized in that, Including the following steps: S01. Collect raw data of the target watershed, including: DEM data, remote sensing image data, soil sampling point data and hourly rainfall data; S02. Data Processing: Unify all raw data into the same coordinate system and divide it into grid cells. Each grid cell records its spatial coordinates, elevation values, multi-band reflectance values, soil sampling attributes, and rainfall intensity time series to generate a basic database. S03. Construction of Rainfall Erosion Field: The rainfall intensity time series of each grid cell is divided into multiple independent rainfall events. The squares of all hourly rainfall intensities of the independent rainfall events within 30 days of each grid cell are summed to obtain the time-period cumulative rainfall erosion index of each grid cell. The time-period cumulative rainfall erosion index of all grid cells is divided into three rainfall dynamic impact coefficients of 0.3, 0.65, and 1.0 according to the quantile threshold. S04. Construction of Soil Erosion Field: Based on soil sampling attributes, the inverse distance weighted interpolation method is used to obtain the interpolation results of all grid cells. According to the interpolation results, the grid cells are divided into three soil erosion state levels, and a soil structure stability index is formed for each grid cell. S05. Topographic factor extraction and confluence relationship construction: Based on the elevation value, obtain the slope value and slope length value of each grid cell, and combine the slope value and slope length value to generate the LS level of the grid cell. Obtain the flow direction code of each grid cell through the D8 single flow direction algorithm, establish the first-level upstream grid list of each grid cell based on the flow direction code, and track all confluence path chains in the entire watershed, and record the upstream source level of each grid cell. S06. Obtain upstream confluence push value: Convert the LS level of each grid cell into the topographic risk base of that grid cell, trace the risk contribution of each grid cell upstream along the confluence path chain and sum them all to generate the upstream confluence push value of each grid cell, and record the number and contribution percentage of the top three upstream grid cells with the largest contribution. The risk contribution is equal to the sum of the topographic risk base, the dynamic impact coefficient of rainfall and the soil erodibility status level and multiplied by the distance reduction factor. S07. Extract the spatial coordinates of each grid cell from the basic database, and arrange and merge the rainfall dynamic impact coefficient, soil structure stability index, LS level, upstream source level and upstream confluence push value of each grid cell in sequence to form a fused feature vector. S08. Risk Assessment: Input the fused feature vector into the pre-trained random forest classifier and infer to obtain the probability values of the three categories of low risk, medium risk and high risk for each grid cell.
2. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 1, characterized in that, S02 includes the following steps: S021. Convert the raw data to the geodetic coordinate system and divide the target watershed space into multiple grid units. Assign a unique number to each grid unit and record the coordinates of the center point and the four boundary coordinates of each grid unit as the spatial location identifier of the grid unit. S022. Crop the remote sensing image data into grid cells and obtain the multi-band reflectance value of each grid cell; S023. Extract elevation values from the DEM data by grid cell to obtain the center point elevation and average elevation within each grid cell. S024. Spatially overlay the coordinates of the soil sampling points with the grid cells to obtain the unique number of the grid cell corresponding to each coordinate, and assign the soil texture type and soil organic matter content to the corresponding grid cell. S025. Spatialize the rainfall data by grid and generate hourly rainfall intensity time series for each grid.
3. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 2, characterized in that, S03 includes the following steps: S031. Divide the rainfall intensity time series of each grid cell into multiple independent rainfall events according to the preset continuous rainfall intensity, and record the start time, end time and maximum hourly rainfall intensity of each independent rainfall event within the time period; S032. Sum the squares of all hourly rainfall intensity values within an independent rainfall event to obtain the rainfall erosivity contribution value of that independent rainfall event; S033. Sum the erosivity contribution values of all rainfall events that occurred within the last 30 days in a grid cell to obtain the time-based cumulative rainfall erosivity index of that grid cell. S034. Statistically calculate the cumulative rainfall erosivity index for all grid units in the entire watershed and convert it into a dynamic rainfall impact coefficient. The value is 0.3 for those below the 30th percentile, 0.65 for those between the 30th and 70th percentiles, and 1.0 for those above the 70th percentile.
4. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 2, characterized in that, S04 includes the following steps: S041. Convert the soil texture type of all grid cells into the first to fourth coding values, and convert the soil organic matter content value into the first to fourth grade coding values according to the preset grading threshold to obtain the soil texture code and organic matter grading code. S042. The soil texture code and organic matter classification code of each grid unit are spliced together to form a two-digit comprehensive code for soil erodibility. S043. Use the inverse distance weighted interpolation method to obtain the interpolation results for all grid cells; S044. Divide the interpolation results of all grid cells into three soil erodibility status levels; S045. Extract the interpolation results of all grid cells within a 5×5 window surrounding each grid cell, calculate the variance of the difference results and normalize them, and use them as the soil structure stability index of that grid cell.
5. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 1, characterized in that, S05 includes the following steps: S051. Using the slope tool and cumulative slope length tool, and based on the elevation value, obtain the slope value and slope length value of each grid cell, divide the slope value into three levels, and divide the slope length value into two levels; S052. Combine the slope grade and slope length grade of each grid cell to generate a 6-level combination code, and simplify it into three LS grades, with each grid cell corresponding to one LS grade. S053. Obtain the water flow direction of each grid cell using the D8 single-flow direction algorithm and generate a flow direction code; S054. Traverse all grid cells in the entire watershed, record all other grid cells whose flow direction codes point to the current grid cell, and build a list of first-level upstream grid cells for the current grid cell. S055. Starting from the round-headed grid cell in the first-level upstream grid list, proceed downstream level by level along the flow direction code until the watershed outlet or boundary is reached. Record all the grids passed through in sequence as a confluence path chain, and record the upstream source level of each grid cell in the confluence path chain.
6. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 5, characterized in that, The tracing termination condition for the confluence path chain in S055 is: the elevation value of the grid cell reached along the flow direction is lower than the preset watershed outlet elevation threshold, or the grid cell is located on the target watershed boundary and there is no downstream receiving grid cell.
7. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 1, characterized in that, In S06, when the LS level is the highest, the terrain risk base score is 70 points; when the LS level is the second highest, the terrain risk base score is 45 points; and when the LS level is the lowest, the terrain risk base score is 20 points.
8. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 1, characterized in that, S08 includes the following steps: S081. Input the fused feature vector into a pre-trained random forest classifier. The random forest classifier consists of multiple decision trees. Each decision tree outputs the class distribution of its leaf node to the fused feature vector. S082. Average the category distributions of all decision trees for each category to obtain the probability value of each grid cell belonging to the three categories of low risk, medium risk, and high risk. The sum of the three probability values is equal to 1.
9. The water and soil monitoring method based on topographic factors and upstream-downstream confluence relationship according to claim 1, characterized in that, The training method for the random forest classifier is as follows: Collect the fused feature vectors of each grid cell in historical time periods and the risk level labels confirmed by on-site inspections during the same period as training samples; Multiple training subsets are randomly selected with replacement from the training samples, and a decision tree is trained independently for each training subset. During training, at each node split point, a subset of features are randomly selected from all features as candidate split features, and the splitting method that maximizes the class purity of the child node samples is chosen. After training is complete, each leaf node records the class distribution of the training samples that fall into that node.
