-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the python file containing TL activity for GIS 714 class.
- Loading branch information
1 parent
6671f77
commit cb50825
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"layers": [ | ||
["d.rast", "map=flow"] | ||
], | ||
"base": "elev_lid792_1m", | ||
"scanning_params": { | ||
"smooth": 10, | ||
"zexag": 2, | ||
"numscans": 1, | ||
"interpolate": true | ||
}, | ||
"analyses": "pratikshya.py", | ||
"title": "SIMWE", | ||
"instructions": "Change topography and observe changes in surface water flow." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
import grass.script as gs | ||
|
||
|
||
def run_waterflow(scanned_elev, env, **kwargs): | ||
# first we need to compute x- and y-derivatives | ||
gs.run_command('r.slope.aspect', elevation=scanned_elev, dx='scan_dx', dy='scan_dy', env=env) | ||
gs.run_command('r.sim.water', elevation=scanned_elev, dx='scan_dx', dy='scan_dy', | ||
rain_value=150, infil_value=0, man_value=0.05, depth='flow', nwalkers=100000, niterations=30, env=env) | ||
|
||
|
||
def main(): | ||
env = os.environ.copy() | ||
env["GRASS_OVERWRITE"] = "1" | ||
elevation = "elev_lid792_1m" | ||
elev_resampled = "elev_resampled" | ||
gs.run_command("g.region", raster=elevation, res=4, flags="a", env=env) | ||
gs.run_command("r.resamp.stats", input=elevation, output=elev_resampled, env=env) | ||
|
||
run_waterflow(scanned_elev=elev_resampled, env=env) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters