Project

General

Profile

Download (5.15 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
# Created 15-Jun-2011
8

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

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

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

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

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

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

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

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

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

    
100

    
(2-2/6)