1
|
# GRASS terraflow execution for Oregon case study area, done for
|
2
|
# comparison to the pre-existing Arc GRID flowaccumulation results.
|
3
|
#
|
4
|
# Jim Regetz
|
5
|
# NCEAS
|
6
|
# Created 16-Jun-2011
|
7
|
|
8
|
export DEMDIR=~/media/temp/dem/new/flow
|
9
|
export OUTDIR=~/media/temp/dem/new/flow
|
10
|
|
11
|
#
|
12
|
# Oregon case study
|
13
|
#
|
14
|
|
15
|
# create new mapset for oregon case study
|
16
|
g.mapset -c mapset=oregon
|
17
|
|
18
|
# read in smoothed srtm
|
19
|
# ming did smoothing? note that data type is float
|
20
|
r.in.gdal input=$DEMDIR/srtmv41_smth.tif output=srtmv41_smth
|
21
|
|
22
|
# set region based on this srtm raster
|
23
|
g.region rast=srtmv41_smth
|
24
|
|
25
|
# compute flow
|
26
|
# [took ~3 minutes on xander (16-Jun-2011)]
|
27
|
r.terraflow elevation=srtmv41_smth filled=filled_smth \
|
28
|
direction=direction_smth swatershed=swatershed_smth \
|
29
|
accumulation=accumulation_smth tci=tci_smth
|
30
|
|
31
|
# compute flow again, but this time using SFD (D8)
|
32
|
# [took ~1.5 minutes on xander (16-Jun-2011)]
|
33
|
r.terraflow -s elevation=srtmv41_smth filled=filled_smth_sfd \
|
34
|
direction=direction_smth_sfd swatershed=swatershed_smth_sfd \
|
35
|
accumulation=accumulation_smth_sfd tci=tci_smth_sfd
|
36
|
|
37
|
# write geotiffs out to disk
|
38
|
r.out.gdal input=direction_smth output=$OUTDIR/flowdir_OR_grass.tif
|
39
|
r.out.gdal input=direction_smth_sfd output=$OUTDIR/flowdir_OR_grass_sfd.tif
|