A method and system for judging upstream and downstream reservoirs and intervals based on sub-basin coding

Through the method based on sub-basin coding, the connection relationship and confluence interval of the reservoir group are automatically judged, which solves the problem of low accuracy of manual judgment in the prior art, and improves the efficiency and accuracy of basin management.

CN114117784BActive Publication Date: 2025-07-01SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111406921.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-24
Publication Date
2025-07-01
Estimated Expiration
2041-11-24

AI Technical Summary

Technical Problem

In the watershed management of reservoir groups, the existing technology relies on manual judgment of the connection relationship and convergence interval of reservoir groups, and is prone to errors, especially when the number of reservoirs is large.

Method used

The sub-basin coding method is adopted to obtain the digital elevation model of the target basin, the basin exit location data and the reservoir location data, extract hydrological information, identify the basin exit section, and encode the basin water system, sub-basin and reservoir by using the river coding method from the basin exit to the upstream direction, so as to judge the connection relationship and confluence interval of the reservoir.

Benefits of technology

The judgment accuracy and efficiency in reservoir group basin management is improved, the connection relationship and confluence interval of reservoir group are accurately analyzed, and the basin management and reservoir group scheduling are supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114117784B_ABST
    Figure CN114117784B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of hydrology and water resources, and proposes an upstream and downstream reservoir and interval judgment method and system based on sub-basin coding, which includes the following steps: obtaining a digital elevation model, basin outlet location data, and basin reservoir location data of a target basin; extracting hydrological information from the digital elevation model, and obtaining the flow direction data, basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data; identifying the basin outlet reach according to the basin outlet location, and coding the basin water system, sub-basins, and reservoirs by means of a river coding method from the basin outlet to the upstream direction; identifying the connection relationship of each reservoir in the target basin according to the coding characteristics, and judging the confluence interval of the reservoirs. The present invention can help basin management workers analyze the connection relationship of basin reservoir groups with high efficiency, and effectively ensure the high efficiency and high accuracy of the basin management work of reservoir groups.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hydrology and water resources, and more specifically, to a method and system for judging upstream and downstream reservoirs and intervals based on sub-basin coding. Background Art

[0002] A reservoir group refers to a group of reservoirs within a basin that have hydraulic, hydrological connections with each other and can cooperate with each other to a certain extent. Regulating a reservoir group is not only related to the exertion of various benefits but also related to the safety of reservoir dams. The hydraulic connection relationship of the reservoir group and the control area of each reservoir are the concerns of basin management workers.

[0003] Currently, in the basin management work of a reservoir group, data acquisition devices are mainly used to collect reservoir data corresponding to each location node and then send it to a data server, etc. for summary analysis and manual judgment. However, in actual work, the connection relationship of the reservoir group in the basin and the confluence interval between the reservoir and the upstream reservoir are only determined manually, which is prone to errors when the number of reservoirs is too large. Summary of the Invention

[0004] In order to overcome the defects of low judgment accuracy and low efficiency existing in the basin management work of the reservoir group by only using manual judgment in the above-mentioned prior art, the present invention provides a method and system for judging upstream and downstream reservoirs and intervals based on sub-basin coding.

[0005] To solve the above technical problems, the technical solution of the present invention is as follows:

[0006] A method for judging upstream and downstream reservoirs and intervals based on sub-basin coding includes the following steps:

[0007] S1. Obtain the digital elevation model, basin outlet location data, and basin reservoir location data of the target basin;

[0008] S2. Extract hydrological information from the digital elevation model, and extract the flow direction data, basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data;

[0009] S3. Identify the basin outlet reach according to the basin outlet location, and code the basin water system, sub-basins, and reservoirs using a river coding method from the basin outlet upstream;

[0010] S4. Identify the connection relationship of each reservoir in the target basin according to the coding characteristics, and judge the confluence interval of the reservoir.

[0011] As a preferred solution, the basin water system data includes the confluence area, slope, and head drop information of each reach in the target basin.

[0012] As a preferred solution, in the step S3, the step of identifying the river reach at the basin outlet according to the basin outlet position includes:

[0013] S3.1. Calculate the Euclidean distance between the basin outlet position of the target basin and each river reach in the basin water system, and identify the river reach at the basin outlet link according to the Euclidean distance between each river reach and the basin outlet out ; The calculation formula is as follows:

[0014] d i = f(link i , outlet)

[0015] link out = link i | d i = d min

[0016] In the formula, link i is the i-th river reach in the basin water system, and i = 1, 2,..., N, where N is the total number of river reaches in the basin water system, and outlet represents the basin outlet position; d i is the distance between the i-th river reach and the basin outlet, and d min is the minimum distance from the basin outlet to each river reach; link out is the river reach at the basin outlet.

[0017] As a preferred solution, in the step S3, the step of coding the basin water system by the river coding method from the basin outlet upstream includes:

[0018] S3.2.1. Code the river reach at the basin outlet as code(link out ) = '001';

[0019] S3.2.2. For any river reach, according to the confluence area sizes of its two sub-river reaches, regard the sub-river reach with a larger confluence area as the main river reach and the other sub-river reach as the branch river reach;

[0020] S3.2.3. Code the river reaches one by one from the river reach at the basin outlet link out upstream: For the main river reach, its code is the last digit of the parent river reach code plus one; for the branch river reach, its code is the last digit of the parent river reach code plus '001'.

[0021] As a preferred solution, in the step S3, the step of coding the sub-basin and reservoir by the river coding method from the basin outlet upstream includes:

[0022] S3.3. Make the sub-basin correspond to the river reaches in the basin water system structure one by one, and its expression formula is as follows:

[0023] code(basin i ) = code(link i )

[0024] In the formula, code(basin i ) represents the code of the \(i\)-th sub-basin basin i , and code(link i ) represents the code of the \(i\)-th river section link i ;

[0025] S3.4. According to the positional relationship between the reservoir and the sub-basin, encode the reservoir to be the same as the code of the sub-basin to which it belongs in terms of its spatial position.

[0026] As an optimal solution, in the step S4, the steps of identifying the connection relationship of each reservoir in the target basin according to the coding characteristics include:

[0027] S4.1. For the reservoir code code i with any \(n\)-digit coding number, take the first \(n - 3\) digits in the reservoir code code i as the parent river section code code i_father , and take the last 3 digits in the reservoir code code i as the level code code i_self ;

[0028] S4.2. For any two reservoir codes code a , code b , according to their parent river section codes code a_father , code b_father , level codes code a_self , code b_self , and the coding length, judge the upstream and downstream relationship between the corresponding reservoir a and reservoir b:

[0029] (1) If the coding length of the reservoir code code a is equal to the coding length of the reservoir code code b , then when the parent river section code code a_father of reservoir a is equal to the parent river section code code b_father of reservoir b, and the level code code a_self of reservoir a is less than the level code code b_self of reservoir b, then judge that reservoir a is downstream of reservoir b; otherwise, judge that reservoir a is upstream of reservoir b;

[0030] (2) If the coding length of the reservoir code code a is less than the coding length of the reservoir code code bIf the coding length of a the reservoir a's code b_father is less than or equal to the code of the parent river section of reservoir b, then it is determined that reservoir a is downstream of reservoir b; otherwise, it is determined that reservoir a is upstream of reservoir b.

[0031] (3) In other cases where (1) or (2) is not satisfied, it is determined that reservoir a is upstream of reservoir b.

[0032] As an optimal solution, in the step S4, the following steps are further included: constructing a reservoir code storage list, using a double loop, and sequentially determining the upstream and downstream relationships between one reservoir code in the list and the remaining reservoir codes in the list according to steps S4.1 and S4.2, and saving the upstream and downstream relationship results of the two reservoirs in the form of a matrix; after iterative looping, the connection matrix R of the reservoir group is obtained, and its expression formula is as follows:

[0033] R = (status ij ) N×N , i, j = 1, 2,..., N

[0034] In the formula, status ij represents the upstream and downstream relationship result between reservoir i and reservoir j, and status ij = 1 indicates that reservoir i is downstream of reservoir j, and status ij = 0 indicates that reservoir i is upstream of reservoir j; N is the total number of reservoirs in the target basin.

[0035] As an optimal solution, in the step S4, the steps of judging the confluence area of the reservoir include:

[0036] S4.3: Taking the flow direction data and the basin reservoir location data as inputs, obtaining the upstream control range D of each reservoir through the Gage Watershed function;

[0037] S4.4: For any reservoir j, according to the upstream control range D j of reservoir j, and the connection relationship between reservoir j and other reservoirs, obtaining the set of upstream reservoirs of reservoir j; taking the difference set between the upstream control range D j of reservoir j and the upstream control ranges of each upstream reservoir, obtaining the confluence area of reservoir j Its expression formula is as follows:

[0038]

[0039] In the formula, D1, D2,..., D n represent the upstream control ranges corresponding to the n upstream reservoirs of reservoir j respectively.

[0040] Furthermore, the present invention also proposes an upstream and downstream reservoir and confluence interval judgment system based on sub-basin coding, which applies the upstream and downstream reservoir and confluence interval judgment method based on sub-basin coding proposed in any of the above technical solutions, and specifically includes a data acquisition module, a hydrological information extraction module, a watershed outlet reach identification module, a coding module, an upstream and downstream reservoir judgment module, and a confluence interval judgment module.

[0041] Among them, the data acquisition module is used to obtain the digital elevation model, watershed outlet location data, and watershed reservoir location data of the target watershed; the hydrological information extraction module is used to extract hydrological information from the digital elevation model, and extract the flow direction data, watershed water system data, and sub-basin data of each pixel in the digital elevation model according to the watershed outlet location data and watershed reservoir location data; the watershed outlet reach identification module is used to identify the location of the watershed outlet reach according to the watershed outlet location; the coding module is used to code the watershed water system, sub-basins, and reservoirs by the river coding method from the watershed outlet upstream; the upstream and downstream reservoir judgment module is used to identify the connection relationship of each reservoir in the target watershed according to the coding characteristics; the confluence interval judgment module is used to judge the confluence interval of the reservoirs according to the connection relationship of each reservoir in the target watershed.

[0042] Furthermore, the present invention also proposes an upstream and downstream reservoir and confluence interval judgment system, which includes a processor and a memory. A computer program is stored on the memory, and when the processor executes the computer program in the memory, the steps of the upstream and downstream reservoir and confluence interval judgment method in any of the above technical solutions are realized.

[0043] Compared with the prior art, the beneficial effects of the technical solution of the present invention are: The present invention uses sub-basin coding to code the sub-basins and reservoirs in the target watershed, and then judges and analyzes the connection relationship of each reservoir and the confluence interval according to the coding results, which can help watershed management workers analyze the connection relationship of the watershed reservoir group efficiently, and effectively ensure the high efficiency and high accuracy of the watershed management work of the reservoir group. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flowchart of the upstream and downstream reservoir and confluence interval judgment method based on sub-basin coding in Embodiment 1.

[0045] Figure 2 It is a flowchart of coding the watershed water system, sub-basins, and reservoirs in Embodiment 1.

[0046] Figure 3 It is a schematic diagram of the pseudo code for judging the upstream and downstream connection relationship of the reservoir in Embodiment 1.

[0047] Figure 4 It is a schematic diagram of the original elevation model of the Xijiang River Basin, reservoir locations, and watershed outlet locations in Embodiment 2.

[0048] Figure 5 Schematic diagram of the extracted river basin water system and sub-basins of Example 2.

[0049] Figure 6 Schematic diagram of the reservoir connection relationship of Example 2.

[0050] Figure 7 Schematic diagram of the confluence area of Luodong Reservoir in the Xijiang River Basin of Example 2.

[0051] Figure 8 Architecture diagram of the upstream and downstream reservoir and interval judgment system based on sub-basin coding of Example 3. Detailed implementation manners

[0052] The accompanying drawings are only for illustrative purposes and should not be construed as a limitation of this patent;

[0053] To better illustrate this embodiment, some components in the accompanying drawings will be omitted, enlarged or reduced, which do not represent the dimensions of the actual product;

[0054] For those skilled in the art, it is understandable that some well-known structures and their descriptions in the accompanying drawings may be omitted.

[0055] The technical solutions of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0056] Example 1

[0057] This example proposes a method for judging upstream and downstream reservoirs and intervals based on sub-basin coding. As Figure 1 shown, it is the flowchart of the method for judging upstream and downstream reservoirs and intervals based on sub-basin coding of this example.

[0058] In the method for judging upstream and downstream reservoirs and intervals based on sub-basin coding proposed in this example, the following steps are included:

[0059] S1. Obtain the digital elevation model, basin outlet location data, and basin reservoir location data of the target basin.

[0060] S2. Extract hydrological information from the digital elevation model, and extract the flow direction data, river basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data.

[0061] In a specific embodiment, the watershed_delineation function in the third-party open-source library pygeoc of python is used to call the TauDEM program to extract hydrological information from the digital elevation model.

[0062] In this embodiment, the retrieved river system data of the basin includes the confluence area, slope, and head drop information of each river section in the target basin.

[0063] S3. Identify the river section at the basin outlet according to the basin outlet position, and code the river system, sub-basins, and reservoirs using the river coding method from the basin outlet upstream.

[0064] In this embodiment, the steps of coding the river system, sub-basins, and reservoirs are as Figure 2 shown, including the following steps:

[0065] S3.1. Calculate the Euclidean distance between the basin outlet position of the target basin and each river section in the river system, and identify the river section at the basin outlet link according to the Euclidean distance between each river section and the basin outlet. out ; Its calculation formula is as follows:

[0066] d i = f(link i , outlet)

[0067] link out = link i |d i = d min

[0068] In the formula, link i is the i-th river section in the river system, and i = 1, 2,..., N, where N is the total number of river sections in the river system, and outlet represents the basin outlet position; d i is the distance between the i-th river section and the basin outlet, d min is the minimum distance from the basin outlet to each river section; link out is the river section at the basin outlet.

[0069] S3.2. Code the river system using the river coding method from the basin outlet upstream.

[0070] The specific steps are as follows:

[0071] S3.2.1. First, determine the code of the river section at the basin outlet, and code the river section at the basin outlet as:

[0072] code(link out ) = '001'.

[0073] S3.2.2. For any river section, according to the confluence area of its two sub-river sections, take the sub-river section with a larger confluence area as the main river section, and the other river section as the branch river section.

[0074] In this embodiment, the river system of the watershed extracted from the digital elevation model is a binary tree structure. Except for the uppermost river section, each river section has two sub-river sections. When coding the river sections, the two sub-river sections need to be coded as the main river section and the branch river section respectively.

[0075] S3.2.3. Coding the river sections one by one from the river section at the watershed outlet link out upstream: For the main river section, its code is the last digit of the parent river section code plus one; for the branch river section, its code is the last digit of the parent river section code increased by '001'.

[0076] For example, when the parent river section is the outlet river section, the code of the parent river section is code(link father ) = '001';

[0077] Then the code of the main river section in its sub-river sections is code(link main ) = code(link father ) + 1 = '002';

[0078] The code of the branch river section in its sub-river sections is code(link main ) = code(link father ) + '001' = '001001'. S3.3. Corresponding the sub-watersheds with the river sections in the river system structure, and its expression formula is as follows:

[0079] code(basin i ) = code(link i )

[0080] In the formula, code(basin i ) represents the code of the i-th sub-watershed basin i , and code(link i ) represents the code of the i-th river section link i ;

[0081] S3.4. According to the positional relationship between the reservoir and the sub-watershed, code the reservoir to be the same as the code of the sub-watershed to which it belongs in terms of spatial position.

[0082] In this step, a river coding method from the watershed outlet upstream is adopted, and it is necessary to first identify the outlet river section directly connected to the watershed outlet in the river system structure.

[0083] In a specific embodiment, the data of the basin outlet location is read and converted into a GeoDataFrame object. Using the distance method of the GeoDataFrame object, the Euclidean distance between the basin outlet and each river reach in the basin water system is calculated, and the river reach with the shortest Euclidean distance from the basin outlet is used as the basin outlet river reach.

[0084] S4. Identify the connection relationships of the reservoirs in the target basin according to the coding characteristics, and judge the confluence intervals of the reservoirs. In this step, the steps of identifying the connection relationships of the reservoirs in the target basin according to the coding characteristics are as follows:

[0085] S4.1. For the reservoir code code of any n-digit coding number i , the first n - 3 digits in the reservoir code code i are used as the parent river reach code code i_father , and the last 3 digits in the reservoir code code i are used as the level code code i_self .

[0086] Among them, the parent river reach code can indicate the river reach that the river reach flows into, and the level code can indicate how many tributaries the river reach will converge with before entering the parent river reach. By splitting the reservoir code according to this step, the hydraulic connection relationship between the river reach and other river reaches in the water system can be quickly judged according to the code.

[0087] For example, for the river reach with the code '002003', it will converge with the river reaches with the codes '002002001' and '002001001', and flow into the parent river reach with the code '002'.

[0088] S4.2. For any two reservoir codes code a , code b , according to their parent river reach codes code a_father , code b_father , level codes code a_self , code b_self , and the coding lengths, judge the upstream and downstream relationships of the corresponding reservoirs a and b:

[0089] (1) If the coding lengths of the reservoir codes code a and the reservoir code code b are equal, then when the parent river reach code code a_father of reservoir a is equal to the parent river reach code code b_father of reservoir b, and the level code code a_self of reservoir a is less than the level code code b_selfIf so, it is determined that Reservoir a is downstream of Reservoir b; otherwise, it is determined that Reservoir a is upstream of Reservoir b.

[0090] (2) If the coding length of the reservoir coding code a is less than the coding length of the reservoir coding code b , then when the coding code a of Reservoir a is less than or equal to the coding code b_father of the parent river section of Reservoir b, it is determined that Reservoir a is downstream of Reservoir b; otherwise, it is determined that Reservoir a is upstream of Reservoir b.

[0091] (3) In other cases where (1) or (2) is not satisfied, it is determined that Reservoir a is upstream of Reservoir b.

[0092] The pseudocode of the above S4.2 step is as Figure 3 shown.

[0093] In another specific embodiment, the following steps are further included:

[0094] Construct a list for storing reservoir codings. Using a double loop, sequentially determine the upstream and downstream relationships between one reservoir coding in the list and the remaining reservoir codings in the list according to the steps of S4.1 and S4.2, and save the results of the upstream and downstream relationships between the two reservoirs in matrix form; after iterative loops, obtain the connection matrix R of the reservoir group, and its expression formula is as follows:

[0095] R = (status ij ) N×N , i, j = 1, 2,..., N

[0096] In the formula, status ij represents the result of the upstream and downstream relationship between Reservoir i and Reservoir j, and status ij = 1 indicates that Reservoir i is downstream of Reservoir j, and status ij = 0 indicates that Reservoir i is upstream of Reservoir j; N is the total number of reservoirs in the target basin.

[0097] Use the third-party Python library Pandas to save the connection matrix as an.xlsx table file, which can be opened with Excel software for easy viewing.

[0098] Furthermore, the steps for determining the confluence area of the reservoir are as follows:

[0099] S4.3: Use the flow direction data and the basin reservoir location data as inputs, and obtain the upstream control range D of each reservoir through the Gage Watershed function.

[0100] In a specific implementation process, the GageWatershed function in the TauDEM program is called using Python. Taking the flow direction data (.tif) and reservoir location data (.shp) extracted in (1) as inputs, the upstream control range D of each reservoir can be obtained, and the control range D of each reservoir is saved as raster data (.tif).

[0101] S4.4. For any reservoir j, based on the upstream control range D of reservoir j j , and the connection relationship between reservoir j and other reservoirs, the set of upstream reservoirs of reservoir j is obtained; the difference set is taken between the upstream control range D of reservoir j j and the upstream control ranges of each upstream reservoir to obtain the confluence interval of reservoir j Its expression formula is as follows:

[0102]

[0103] In the formula, D1, D2,..., D n represent the upstream control ranges corresponding to the n upstream reservoirs of reservoir j respectively.

[0104] This embodiment proposes a fast, automatic, and simple method for judging upstream and downstream reservoirs and confluence intervals. The sub-watershed coding is used to code the sub-watersheds and reservoirs in the target watershed, and then the connection relationship and confluence interval of each reservoir are judged and analyzed according to the coding results, which can help watershed management workers efficiently analyze the connection relationship of the reservoir group in the watershed and is of great significance for watershed management and reservoir group scheduling.

[0105] Embodiment 2

[0106] This embodiment applies the method for judging upstream and downstream reservoirs and intervals based on sub-watershed coding proposed in Embodiment 1 to judge the upstream and downstream reservoirs and intervals of the reservoir group in the Xijiang River Basin of China.

[0107] In the specific implementation process, the digital elevation model, Xijiang River Basin outlet location data, and reservoir location data required for judging the upstream and downstream reservoirs and intervals in the Xijiang River Basin are stored in the same folder. Variables dem, outlet, and dam are respectively defined to store the corresponding paths, and these files are called through the watershed_delineation function in pygeoc to extract the hydrological information of the Xijiang River Basin.

[0108] In this embodiment, the original elevation model of the Xijiang River Basin, reservoir locations, and basin outlet locations are as Figure 4 shown. The hydrological information of the digital elevation model is extracted, and based on the basin outlet location data and basin reservoir location data, the flow direction data, basin water system data, and sub-watershed data of each pixel in the digital elevation model are extracted, obtaining asFigure 5 Schematic diagram of the river basin water system and sub-basins shown

[0109] Encode the water system, sub-basins, and reservoirs in the Xijiang River Basin. The specific steps are as follows:

[0110] (1) Use the read_file function of GeoPandas to read the data of the river basin outlet location and the data of the river basin water system, sub-basins, and reservoir locations extracted in S1, and convert them into GeoDataFrame objects. Use the distance method in the GeoDataFrame object to calculate the distance between the river basin outlet and each river section, and obtain the outlet river section.

[0111] (2) Use a while loop in Python, adopt the river coding method from the river basin outlet upstream, and encode the water system of the Xijiang River Basin section by section according to the coding method introduced in the above technical solution. Use the to_file method of GeoDataFrame to save the encoded water system of the Xijiang River Basin.

[0112] (3) Encode the sub-basins corresponding to each river section, and the encoding value is the same as the encoding value of the corresponding river section. Use the to_file method of GeoDataFrame to save the encoded Xijiang sub-basins.

[0113] (4) According to the positional relationship between the reservoirs and sub-basins in the Xijiang River Basin, the reservoir encoding is the same as the sub-basin to which it belongs in terms of its spatial location. Use the to_file method to save the encoded reservoirs.

[0114] After completing the encoding of the water system, sub-basins, and reservoirs in the Xijiang River Basin, judge the upstream and downstream reservoirs and the confluence intervals. The specific steps are as follows:

[0115] (1) Use a for loop in Python. For any reservoir, according to the method of judging the upstream and downstream relationship by encoding, judge the connection relationship between this reservoir and other reservoirs one by one, and construct the connection matrix of the reservoir group in the Xijiang River Basin. Use the third-party library Pandas in Python to save the connection matrix. The reservoir connection relationship is as Figure 6 shown.

[0116] (2) Use Python to call the GageWatershed function in the TauDEM program to calculate the upstream control range of each reservoir in the Xijiang River Basin. The control range of each reservoir is saved as GeoTiff format data.

[0117] (3) For any reservoir in the Xijiang River Basin, based on the connection matrix constructed in (1), obtain its upstream reservoirs. Use the Open function in the third-party Python library Gdal to read the control ranges of this reservoir and its upstream reservoirs. Use the Boolean operator & in Python to take the union of the upstream reservoirs to obtain the total control range of the upstream reservoirs. Use the Boolean operators & and ~ in Python to take the complement of the control range of this reservoir and the total control range of the upstream reservoirs to obtain the confluence interval of this reservoir. The confluence interval of Luodong Reservoir in the Xijiang River Basin is as Figure 7 shown.

[0118] In another specific embodiment, use the class() and def() statements in Python to encapsulate the various steps of sub-basin coding and the judgment of upstream and downstream reservoirs and intervals into classes and functions, and save them as a.py file. When in use, only need to call the developed classes and functions through the import statement to judge the upstream and downstream relationships and intervals of each reservoir in the basin.

[0119] Embodiment 3

[0120] This embodiment proposes a system for judging upstream and downstream reservoirs and intervals based on sub-basin coding, and applies a method for judging upstream and downstream reservoirs and intervals based on sub-basin coding proposed in Embodiment 1. As Figure 8 shown, it is the architecture diagram of the system for judging upstream and downstream reservoirs and intervals based on sub-basin coding in this embodiment.

[0121] In the system for judging upstream and downstream reservoirs and intervals based on sub-basin coding proposed in this embodiment, it includes a data acquisition module 1, a hydrological information extraction module 2, a basin outlet reach identification module 3, a coding module 4, an upstream and downstream reservoir judgment module 5, and a confluence interval judgment module 6.

[0122] In the specific implementation process, after the data acquisition module 1 obtains the digital elevation model, basin outlet location data, and basin reservoir location data of the target basin, it sends them to the hydrological information extraction module 2. The hydrological information extraction module 2 extracts hydrological information from the digital elevation model, and extracts the flow direction data, basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data, and then sends the extracted flow direction data, basin water system data, and sub-basin data of each pixel to the basin outlet reach identification module 3.

[0123] The basin outlet reach identification module 3 identifies the basin outlet reach according to the basin outlet location. Specifically, the basin outlet reach identification module 3 calculates the Euclidean distance between the basin outlet location of the target basin and each reach in the basin water system, and identifies the basin outlet reach according to the Euclidean distance between each reach and the basin outlet. The basin outlet reach identification module 3 sends the identified basin outlet reach data to the coding module 4.

[0124] The coding module 4 codes the river basin water system, sub-basins and reservoirs by using a river coding method from the basin outlet upstream, and sends the coding results to the upstream and downstream reservoir judgment module 5 and the confluence interval judgment module 6.

[0125] The upstream and downstream reservoir judgment module 5 identifies the connection relationships of the reservoirs in the target basin according to the coding characteristics, and sends the identified connection relationships of the reservoirs to the confluence interval judgment module 6.

[0126] The confluence interval judgment module 6 obtains the set of upstream reservoirs of the reservoir according to the upstream control ranges of the reservoirs and the connection relationships between the reservoirs, and then makes a difference set between the upstream control range of the reservoir and the upstream control ranges of the upstream reservoirs to obtain the confluence interval of the reservoir and outputs it.

[0127] Embodiment 4

[0128] This embodiment proposes an upstream and downstream reservoir and interval judgment system based on sub-basin coding, and applies the upstream and downstream reservoir and interval judgment method based on sub-basin coding proposed in Embodiment 1.

[0129] In the upstream and downstream reservoir and interval judgment system based on sub-basin coding proposed in this embodiment, it includes a processor and a memory. A computer program is stored on the memory. When the processor executes the computer program in the memory, the steps of the upstream and downstream reservoir and interval judgment method in the above Embodiment 1 are implemented.

[0130] The same or similar reference numerals correspond to the same or similar components;

[0131] Obviously, the above embodiments of the present invention are only examples for clearly explaining the present invention, and are not limitations on the implementation manners of the present invention. For those of ordinary skill in the art, other different forms of changes or modifications can be made on the basis of the above description. It is not necessary and impossible to enumerate all the implementation manners here. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A method for judging upstream and downstream reservoirs and intervals based on sub - watershed coding, characterized in that It includes the following steps: S1. Obtain the digital elevation model, basin outlet location data, and basin reservoir location data of the target basin; S2. Extract hydrological information from the digital elevation model, and extract the flow direction data, basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data; S3. Identify the outlet reach of the basin according to the basin outlet location, and encode the basin water system, sub-basins, and reservoirs using the river coding method from the basin outlet upstream; where: S3.

1. Calculate the Euclidean distance from the outlet location of the target basin to each river reach in the river system of the basin, and identify the outlet reach link of the basin according to the Euclidean distance between each reach and the basin outlet. out The calculation formula is as follows: S3.

2. Encode the basin water system using the river coding method from the basin outlet upstream; S3.

3. Make each sub-basin correspond to a reach in the basin water system structure, and its expression formula is as follows: code(basin i ) = code(link i ) where code(basin i ) represents the code of the \(i\)-th sub-basin basin i , and code(link i ) represents the code of the \(i\)-th river reach link i ; S3.

4. According to the positional relationship between the reservoir and the sub-basin, encode the reservoir to be the same as the code of the sub-basin to which it belongs in terms of its spatial location; S4. Identify the connection relationship of each reservoir in the target basin according to the coding characteristics, and judge the confluence interval of the reservoir; where: S4.

1. For any reservoir code code of an n - digit encoded number i , take the first n - 3 bits in the reservoir code code i as the parent river section code code i_father , and take the last 3 bits in the reservoir code code i as the level code code i_self ; S4.

2. For any two reservoir codes code a and code b , based on their parent river section codes code a_father and code b_father , level codes code a_self and code b_self , and the code length, determine the upstream and downstream relationship between the corresponding reservoir a and reservoir b: (1) If the reservoir code is code a and the coding length of a is equal to the coding length of the reservoir code b , then when the parent river section code of reservoir a is code a_father and is equal to the parent river section code of reservoir b, which is code b_father , and the level code of reservoir a, which is code a_self is less than the level code of reservoir b, which is code b_self , then it is determined that reservoir a is downstream of reservoir b; otherwise, it is determined that reservoir a is upstream of reservoir b; (2) If the reservoir code a has a coding length less than that of the reservoir code b , then when the code a of reservoir a is less than or equal to the code of the parent river section of reservoir b b_father , it is determined that reservoir a is downstream of reservoir b; otherwise, it is determined that reservoir a is upstream of reservoir b. (3) In other cases where (1) or (2) is not satisfied, judge that reservoir a is upstream of reservoir b.

2. The upstream and downstream reservoir and interval judgment method according to claim 1, wherein The basin water system data includes the confluence area, slope, and head drop information of each reach in the target basin.

3. The upstream and downstream reservoir and interval judgment method according to claim 1, wherein In the step S3.1, calculate the Euclidean distance between the outlet position of the target basin and each river segment in the river system of the basin, and identify the outlet river segment link of the basin according to the Euclidean distance between each river segment and the basin outlet. out The calculation formula is as follows: d i = f(link i , outlet) link out = link i |d i = d min where link i is the i-th river reach in the river system of the basin, and i = 1, 2, ..., N, where N is the total number of river reaches in the river system of the basin, and outlet represents the location of the basin outlet; d i is the distance between the i-th river reach and the basin outlet, and d min is the minimum distance from the basin outlet to each river reach; link out is the river reach at the basin outlet.

4. The upstream and downstream reservoir and interval judgment method according to claim 3, characterized in that In the step S3.2, the steps of encoding the basin water system using the river coding method from the basin outlet upstream include: S3.2.

1. Encode the river reach at the basin outlet as code(link out ) = '001'; S3.2.

2. For any reach, according to the confluence area sizes of its two sub-reaches, take the sub-reach with a larger confluence area as the main reach, and take the other sub-reach as the branch reach; S3.2.

3. Link from the river reach at the basin outlet out Code the river reaches one by one in the upstream direction: for the main river reach, its code is the last digit of the parent river reach code plus one; for the branch river reach, its code is the last digit of the parent river reach code plus '001'.

5. The upstream and downstream reservoir and interval judgment method according to any one of claims 1 to 4, characterized in that, In the step S4, the following steps are also included: Construct a reservoir code storage list, use a double loop, and in sequence, judge the upstream and downstream relationship between a reservoir code in the list and the remaining reservoir codes in the list according to the steps S4.1 and S4.2, and save the upstream and downstream relationship results of the two reservoirs in the form of a matrix; after cyclic iteration, obtain the connection matrix R of the reservoir group, and its expression formula is as follows: R = (status ij ) N×N , i, j = 1, 2, ..., N where status ij represents the upstream and downstream relationship result between reservoir i and reservoir j, and status ij = 1 indicates that reservoir i is downstream of reservoir j, and status ij = 0 indicates that reservoir i is upstream of reservoir j; N is the total number of reservoirs in the target basin.

6. The upstream and downstream reservoir and interval judgment method according to claim 5, wherein In the step S4, the steps of judging the confluence interval of the reservoir include: S4.

3. Take the flow direction data and basin reservoir location data as inputs, and obtain the upstream control range D of each reservoir through the Gage Watershed function; S4.

4. For any reservoir j, based on the upstream control range D of reservoir j j , and the connection relationships between reservoir j and other reservoirs, obtain the set of upstream reservoirs of reservoir j; take the difference set between the upstream control range D j of reservoir j and the upstream control ranges of each upstream reservoir to obtain the confluence interval of reservoir j Its expression formula is as follows: where D1, D2, ..., D n represent the upstream control ranges corresponding to the n upstream reservoirs of reservoir j respectively.

7. A system for judging upstream and downstream reservoirs and intervals based on sub - watershed coding, applying the method for judging upstream and downstream reservoirs and intervals according to any one of claims 1 to 6, characterized in that, It includes: A data acquisition module for obtaining the digital elevation model, basin outlet location data, and basin reservoir location data of the target basin; A hydrological information extraction module for extracting hydrological information from the digital elevation model and extracting the flow direction data, basin water system data, and sub-basin data of each pixel in the digital elevation model according to the basin outlet location data and basin reservoir location data; A basin outlet reach identification module for identifying the location of the basin outlet reach according to the basin outlet location; An encoding module for encoding the basin water system, sub-basins, and reservoirs using the river coding method from the basin outlet upstream; An upstream and downstream reservoir judgment module for identifying the connection relationship of each reservoir in the target basin according to the coding characteristics; A confluence interval judgment module for judging the confluence interval of the reservoir according to the connection relationship of each reservoir in the target basin.

8. An upstream and downstream reservoir and interval judgment system based on sub - watershed coding, characterized in that, It includes a processor and a memory, and a computer program is stored on the memory. When the processor executes the computer program in the memory, the steps of the upstream and downstream reservoir and interval judgment method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Distributed hydrological model sub-basin division method considering multiple elements

    CN110717251A

  • Method for automatically dividing and encoding one-dimensional model calculation unit of river network area

    CN112163322A