Project

General

Profile

Download (4.26 KB) Statistics
| Branch: | Revision:
1
# GRASS commands -- testing some stuff for flow direction
2
#
3
# Jim Regetz
4
# NCEAS
5
# Created 15-Jun-2011
6

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

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

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

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

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

    
45
# now with SFD (D8) algorithm
46
# each took ~1 min on xander (22-Jun-2011)
47
r.terraflow.short -s elevation=cdem_300straddle filled=filled_cdem_sfd \
48
  direction=direction_cdem_sfd swatershed=swatershed_cdem_sfd \
49
  accumulation=accumulation_cdem_sfd tci=tci_cdem_sfd
50
r.terraflow.short -s elevation=aster_300straddle filled=filled_aster_sfd \
51
  direction=direction_aster_sfd swatershed=swatershed_aster_sfd \
52
  accumulation=accumulation_aster_sfd tci=tci_aster_sfd
53
r.terraflow.short -s elevation=fused_300straddle filled=filled_fused_sfd \
54
  direction=direction_fused_sfd swatershed=swatershed_fused_sfd \
55
  accumulation=accumulation_fused_sfd tci=tci_fused_sfd
56
r.terraflow.short -s elevation=fused_300straddle_blendgau filled=filled_fused_bg_sfd \
57
  direction=direction_fused_bg_sfd swatershed=swatershed_fused_bg_sfd \
58
  accumulation=accumulation_fused_bg_sfd tci=tci_fused_bg_sfd
59

    
60
# export flow dir rasters as tif
61
r.out.gdal input=direction_cdem output=$FLOWDIR/cdem_300straddle_mfd.tif
62
r.out.gdal input=direction_cdem_sfd output=$FLOWDIR/cdem_300straddle_sfd.tif
63
r.out.gdal input=direction_aster output=$FLOWDIR/aster_300straddle_mfd.tif
64
r.out.gdal input=direction_aster_sfd output=$FLOWDIR/aster_300straddle_sfd.tif
65
r.out.gdal input=direction_fused output=$FLOWDIR/fused_300straddle_mfd.tif
66
r.out.gdal input=direction_fused_sfd output=$FLOWDIR/fused_300straddle_sfd.tif
67
r.out.gdal input=direction_fused_bg output=$FLOWDIR/fused_300straddle_blendgau_mfd.tif
68
r.out.gdal input=direction_fused_bg_sfd output=$FLOWDIR/fused_300straddle_blendgau_sfd.tif
69

    
70
# export flow accum
71
r.out.gdal input=accumulation_fused_bg output=$FLOWDIR/fused_300straddle_blendgau_fa.tif
72
r.out.gdal input=accumulation_cdem output=$FLOWDIR/cdem_300straddle_fa.tif
73
r.out.gdal input=accumulation_aster output=$FLOWDIR/aster_300straddle_fa.tif
74

    
75
# do the above for SRTM, but only in southern half of region
76
g.region n=60 s=59.875 w=-125 e=-100
77
r.terraflow.short elevation=srtm_150below filled=filled_srtm \
78
  direction=direction_srtm swatershed=swatershed_srtm \
79
  accumulation=accumulation_srtm tci=tci_srtm
80
r.terraflow.short -s elevation=srtm_150below filled=filled_srtm_sfd \
81
  direction=direction_srtm_sfd swatershed=swatershed_srtm_sfd \
82
  accumulation=accumulation_srtm_sfd tci=tci_srtm_sfd
83
r.out.gdal input=direction_srtm output=$FLOWDIR/srtm_150below_mfd.tif
84
r.out.gdal input=direction_srtm_sfd output=$FLOWDIR/srtm_150below_sfd.tif
85
r.out.gdal input=accumulation_srtm output=$FLOWDIR/srtm_150below_fa.tif
86
g.region n=60.125 s=59.875 w=-125 e=-100
87

    
88

    
(2-2/6)