Skip to content

Commit

Permalink
Pratikshya TL
Browse files Browse the repository at this point in the history
This is the python file containing TL activity for GIS 714 class.
  • Loading branch information
Pratikshya-Regmi committed Mar 20, 2024
1 parent 6671f77 commit cb50825
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
19 changes: 19 additions & 0 deletions activities/pratikshya_TL.json
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."
}
]
}
27 changes: 27 additions & 0 deletions activities/pratikshya_TL.py
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()
1 change: 1 addition & 0 deletions activities/simple_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def run_slope(scanned_elev, env, **kwargs):
gs.run_command("r.slope.aspect", elevation=scanned_elev, slope="slope", env=env)



def run_contours(scanned_elev, env, **kwargs):
interval = 5
gs.run_command(
Expand Down

0 comments on commit cb50825

Please sign in to comment.