# Grass Gis R.lake Analysis of prediction model of Canyon Lake--flood flooding algorithm in Lake

Source: Internet
Author: User

Grass GIS is the the early 1980s, the U.S. Military Construction Research Laboratory (USA/CERL) Bill Gorgan is responsible for the selection of a land management, environmental planning, environmental assessment of Gis software. It has more than 400 geological analysis modules, today we analyze the r.lake algorithm.

1. What can r.lake do to predict the modeling of the lake

If 1 left is a topographic raster, it is also the most common 2D floor plan. Many concave basins can be seen, and a lake is formed when there are torrential rains. The r.lake of Grass Gis is a module capable of predicting the shape and size of a lake. For example, the red circle position at the left of Figure 1 starts with water injection when the water level is 113.4 meters above the elevation, the formation of the lake's position shape 1 is shown on the right. Grass can form animated dynamic display constantly improve the water level after the change of the form of the lake.

The water level design of the Three Gorges Dam in China is 185 meters, and the reservoir area drowns 129 towns and 19,400 hectares of arable land . east from Yichang, west to Chongqing 662.9Km along the Yangtze River watershed range. At design time, there is a need for very accurate predictions of areas where the 185-metre-high lake can be flooded, and a gap is needed if there is a gap in the coastline that causes the unplanned areas to be flooded.

Grass Gis R.lake can do this thing, its core algorithm is "Lake irrigation flooding algorithm", it simulates the water in a little while flooded the surrounding areas.

Fig. 1 Demonstration of Lake quake prediction model

2. Simplified model of data dimensionality reduction

When a point begins to water storage, the height and shape of the surrounding ridge can block the further spread of the flood, just like a fence. So how do you find out where these fences are based on the elevation of the water level? The first thought is the three-dimensional modeling and spatial relationship calculation and other complex ways, not actually. All the complex three-dimensional computation has to be reduced to two-dimensional plane calculation, simplifying the calculation.

The remote sensing image of an area is processed into an elevation map, which is a raster diagram, and becomes a standard m*n digital matrix. Each point of the matrix is a rectangular area on the map, and the value of that point is the average height of the area. Figure 1 shows a two-dimensional raster, except that each pixel is given a different grayscale color. A complex three-dimensional topography is reduced to a matrix and then becomes a two-dimensional array shown in 2a, the figure is the elevation of a block of land.

Figure 2 Raster map Data matrix

When a lake is required to be 9 meters above sea level, three areas are shown in 2b of the area that satisfies the condition. This seems like a very simple question, that is, to iterate over the array to find the <=9 area. But complex problems come, when the flood points at 6C, the 9 meters of water can only be concentrated in the red area into a lake, yellow and blue should not be submerged, because the water is more than 20 meters high in the red area of the terrain blocked.

Now the problem has been simplified into a simple data structure algorithm. Gradually yearning for expansion at 6 C, like a flood in the middle of the lake until it drowns the area below 9 meters in the surrounding 8 squares. 6C for the surrounding 5b,5c,5d,6b,6d,7b,7c,7d of the lake was drowned. Then repeat the same operation with them for the lake, trying to drown the surrounding 8 neighbor areas. Repeat until there is no new flooded area to be found. The algorithm is simple and does not give the code.

3. Take one or more lake areas as a flood point

The R.lake of Grass Gis provides more complex modeling. It does not take place at a point for flooding, but with a lake that is gushing out of floods and even multiple lakes. So every time above the simulation output of the lake area for the next simulation of the input, constantly increasing the height of the lake, to achieve the animation effect output.

This algorithm idea is similar to the above single point algorithm, only needs to scan each round the m*n pixel point, each time is the next 8 area as long as has a water point to attempt to drown oneself, until a round does not have the new expansion point to stop.

`</pre><p><pre name= "code" class= "cpp" >int pases = (int) (rows * cols)/2;int Water_level = ....//input to The lake elevation int *in_terran; Row * Col Input raster map, numeric value for topography of altitude int *in_wanter; Row * Col input a lake area matrix that already has water. 0 anhydrous, >0 to the depth of the lake to the bottom of the *out_water int; Row * Col outputs the computed lake-area matrix. The initial is 0 anhydrous, and the >0 is the depth copy_seed_water (In_wanter, Out_water) of the lake's surface to the bottom; The initial output lake area is the input lake area int WATER_WINDOW[3][3]; A point-centered 3*3 matrix window that moves through each point of the map for a trip for (pass = 0; pass < pases; pass++) {curcount = 0;/* each point scans */for (row = 0; row < Rows row++) {for (col = 0; col < cols; col++) {//The point is centered to 3*3 matrix Load_neibour_window_values (Out_water, Water_window, rows, CO LS, row, col); Whether the 8 neighbors around the point have water to their side to drown if (is_near_water (water_window) = = 1) {if (In_terran[row][col] < Water_level) {//The terrain is low, flooded out_ Water[row][col] = water_level-in_terran[row][col];curcount++; } else {Out_water[row][col] = 0;/* The topography is higher than the lake surface *}}}}if (Curcount = = Lastcount) break;/* did not find a new flooding point, complete. */lastcount = Curcount;curcount = 0;}} return out_water;`

4. Service support provided by Grass GIS platform

The above algorithm does not see any use of the grass Gis platform API. In fact, the grid data input, output and graphical display are transparent to the grass platform. The Gradient color table for the lake area is built to invoke the API and bind the lake map, but the developer does not know how the color table is stored and bound. The features it provides include:

• The processed geologic data is written directly to the memory of the grass database.
• Generation and binding of geological map color tables
• Three-dimensional overlay display of multiple geologic maps
• Unified management of user-defined data space ranges
so the advantage of using the Grass Gis platform is that it uses its data storage base service, the spatial scope and the display service that the user cares about, and concentrates all the energies on the algorithm itself. Processing operations on address spaces do not provide off-the-shelf services.

Grass Gis R.lake Analysis of prediction model of Canyon Lake--flood flooding algorithm in Lake

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.