September 2019
Beginner
456 pages
10h 53m
English
In the remainder of the script, we load our terrain data from an ASCII Grid, define our output grid filename, and execute the algorithm on the terrain data. The seed of the flood fill algorithm is an arbitrary point, as sx and sy within the lower elevation areas. In a real-world application, these points would likely be a known location, such as a stream gauge or a breach in a dam. In the final step, we save the output grid.
The following steps need to be performed:
source = "terrain.asc"target = "flood.asc"
print("Opening image...")img = np.loadtxt(source, skiprows=6)print("Image opened")