Project

General

Profile

Download (5.12 KB) Statistics
| Branch: | Revision:
1
# GRASS commands for running terraflow on raw and fused DEMs in the
2
# 60N Canada boundary region, currently for the purposes of assessing
3
# and comparing flow direction.
4
#
5
# Jim Regetz
6
# NCEAS
7

    
8
export DEMDIR=~/media/temp/terrain/dem
9
export FLOWDIR=~/media/temp/terrain/flow
10

    
11
#
12
# Canada near 60N, from 136W to 96WW
13
#
14

    
15
# load sample data for testing flow stuff
16
r.in.gdal input=$DEMDIR/cdem_300straddle.tif output=cdem_300straddle
17
r.in.gdal input=$DEMDIR/aster_300straddle.tif output=aster_300straddle
18
r.in.gdal input=$DEMDIR/srtm_150below.tif output=srtm_150below
19
r.in.gdal input=$DEMDIR/fused_300straddle.tif output=fused_300straddle
20
r.in.gdal input=$DEMDIR/fused_300straddle_rampexp.tif output=fused_300straddle_rampexp
21
r.in.gdal input=$DEMDIR/fused_300straddle_blendgau.tif output=fused_300straddle_blendgau
22
r.in.gdal input=$DEMDIR/fused_300straddle_enblend.tif output=fused_300straddle_enblend
23

    
24
# oops -- region is too big for terraflow default of using
25
# dimension_type (i.e., short), which means nrows and ncols are both
26
# capped at ~30K (2^15):
27
#  ERROR: [nrows=300, ncols=48000] dimension_type overflow -- change
28
#         dimension_type and recompile
29
# so let's restrict it to a smaller lon range for now...
30
g.region n=60.125 s=59.875 w=-125 e=-100
31

    
32
# do flow
33
# each took ~1.5 min on xander (22-Jun-2011)
34
r.terraflow.short elevation=cdem_300straddle filled=filled_cdem \
35
  direction=direction_cdem swatershed=swatershed_cdem \
36
  accumulation=accumulation_cdem tci=tci_cdem
37
r.terraflow.short elevation=aster_300straddle filled=filled_aster \
38
  direction=direction_aster swatershed=swatershed_aster \
39
  accumulation=accumulation_aster tci=tci_aster
40
r.terraflow.short elevation=fused_300straddle filled=filled_fused \
41
  direction=direction_fused swatershed=swatershed_fused \
42
  accumulation=accumulation_fused tci=tci_fused
43
r.terraflow.short elevation=fused_300straddle_blendgau filled=filled_fused_bg \
44
  direction=direction_fused_bg swatershed=swatershed_fused_bg \
45
  accumulation=accumulation_fused_bg tci=tci_fused_bg
46
r.terraflow.short elevation=fused_300straddle_enblend filled=filled_fused_mrs \
47
  direction=direction_fused_mrs swatershed=swatershed_fused_mrs \
48
  accumulation=accumulation_fused_mrs tci=tci_fused_mrs
49

    
50
# now with SFD (D8) algorithm
51
# each took ~1 min on xander (22-Jun-2011)
52
r.terraflow.short -s elevation=cdem_300straddle filled=filled_cdem_sfd \
53
  direction=direction_cdem_sfd swatershed=swatershed_cdem_sfd \
54
  accumulation=accumulation_cdem_sfd tci=tci_cdem_sfd
55
r.terraflow.short -s elevation=aster_300straddle filled=filled_aster_sfd \
56
  direction=direction_aster_sfd swatershed=swatershed_aster_sfd \
57
  accumulation=accumulation_aster_sfd tci=tci_aster_sfd
58
r.terraflow.short -s elevation=fused_300straddle filled=filled_fused_sfd \
59
  direction=direction_fused_sfd swatershed=swatershed_fused_sfd \
60
  accumulation=accumulation_fused_sfd tci=tci_fused_sfd
61
r.terraflow.short -s elevation=fused_300straddle_blendgau filled=filled_fused_bg_sfd \
62
  direction=direction_fused_bg_sfd swatershed=swatershed_fused_bg_sfd \
63
  accumulation=accumulation_fused_bg_sfd tci=tci_fused_bg_sfd
64
r.terraflow.short -s elevation=fused_300straddle_enblend filled=filled_fused_mrs_sfd \
65
  direction=direction_fused_mrs_sfd swatershed=swatershed_fused_mrs_sfd \
66
  accumulation=accumulation_fused_mrs_sfd tci=tci_fused_mrs_sfd
67

    
68
# export flow dir rasters as geotiffs
69
r.out.gdal input=direction_cdem output=$FLOWDIR/cdem_300straddle_mfd.tif
70
r.out.gdal input=direction_cdem_sfd output=$FLOWDIR/cdem_300straddle_sfd.tif
71
r.out.gdal input=direction_aster output=$FLOWDIR/aster_300straddle_mfd.tif
72
r.out.gdal input=direction_aster_sfd output=$FLOWDIR/aster_300straddle_sfd.tif
73
r.out.gdal input=direction_fused output=$FLOWDIR/fused_300straddle_mfd.tif
74
r.out.gdal input=direction_fused_sfd output=$FLOWDIR/fused_300straddle_sfd.tif
75
r.out.gdal input=direction_fused_bg output=$FLOWDIR/fused_300straddle_blendgau_mfd.tif
76
r.out.gdal input=direction_fused_bg_sfd output=$FLOWDIR/fused_300straddle_blendgau_sfd.tif
77
r.out.gdal input=direction_fused_mrs output=$FLOWDIR/fused_300straddle_enblend_mfd.tif
78
r.out.gdal input=direction_fused_mrs_sfd output=$FLOWDIR/fused_300straddle_enblend_sfd.tif
79

    
80
# export flow accumulation
81
r.out.gdal input=accumulation_fused_bg output=$FLOWDIR/fused_300straddle_blendgau_fa.tif
82
r.out.gdal input=accumulation_cdem output=$FLOWDIR/cdem_300straddle_fa.tif
83
r.out.gdal input=accumulation_aster output=$FLOWDIR/aster_300straddle_fa.tif
84

    
85
# do the above for SRTM, but only in southern half of region
86
g.region n=60 s=59.875 w=-125 e=-100
87
r.terraflow.short elevation=srtm_150below filled=filled_srtm \
88
  direction=direction_srtm swatershed=swatershed_srtm \
89
  accumulation=accumulation_srtm tci=tci_srtm
90
r.terraflow.short -s elevation=srtm_150below filled=filled_srtm_sfd \
91
  direction=direction_srtm_sfd swatershed=swatershed_srtm_sfd \
92
  accumulation=accumulation_srtm_sfd tci=tci_srtm_sfd
93
r.out.gdal input=direction_srtm output=$FLOWDIR/srtm_150below_mfd.tif
94
r.out.gdal input=direction_srtm_sfd output=$FLOWDIR/srtm_150below_sfd.tif
95
r.out.gdal input=accumulation_srtm output=$FLOWDIR/srtm_150below_fa.tif
96
# don't forget to set the region back to include cells above the 60N boundary...
97
g.region n=60.125 s=59.875 w=-125 e=-100
98

    
99

    
(2-2/6)