[GRASSLIST:10617] ARC FLOWDIRECTION vs GRASS

I'm trying to replicate preparation of data for the DHSVM hydro model in
GRASS following an AML script, and I'm a bit confused why every GRASS module
with flow direction computation produces a different output than the ARC one
-- they even differ between themselves (e.g. r.watershed and r.terraflow).
Does anyone know of a flow direction computation that produces the EXACT
same outputs as ARC? I'm not "judging" which one is better, I'm just trying
to follow as closely as possible the first time around the "idealized"
algorithm.

--j

--

Jonathan A. Greenberg, PhD
NRC Research Associate
NASA Ames Research Center
MS 242-4
Moffett Field, CA 94035-1000
Phone: 415-794-5043
AIM: jgrn3007
MSN: jgrn3007@hotmail.com

On Monday 27 February 2006 05:31 pm, Jonathan Greenberg wrote:

I'm trying to replicate preparation of data for the DHSVM hydro model in
GRASS following an AML script, and I'm a bit confused why every GRASS
module with flow direction computation produces a different output than the
ARC one -- they even differ between themselves (e.g. r.watershed and
r.terraflow). Does anyone know of a flow direction computation that
produces the EXACT same outputs as ARC? I'm not "judging" which one is
better, I'm just trying to follow as closely as possible the first time
around the "idealized" algorithm.

--j

Good questions -- tough answers. I would be sceptical of suggesting that the
Arc-derived output is any better... but to the real subject:

Can you provide more information on the "type" of flow model used by the Arc
AML script? i.e. is it using D4,D8,Rho8,FRho8,DEMON,D-INF flow calculation?

note that D4,D8, and Rho8 are SFD (single input flow direction - single
output)
FD8,FRho8 are MFD (multiple input flow direction - single output)
DEMON and D-INF are similar in many ways, but not identical (multiple input
multiple output?) [1]

Each one of these different treatments of adjacent cells will influence the
output flow map/

Some examples in GRASS see man pages for each command

1. simplest case of the D8 flow direction, stored in new raster dir_d8 :
r.fill.dir in=elev_meters elev=e_filled direction=dir_d8

note that direction can be in the form of 0-360 or 1-8

2. example of the D-INF algorithm (vector output stored in new vector flow)
r.flow elevin=e_filled aspin=aspect flout=flow

3. example of MFD aka FRho8 :
r.terraflow....

note that the direction output will be from 0-255

[1] Wilson and Gallant. Terrain Analysis. 2000

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

It is hard to produce identical outputs for single-flow-direction models, because of the cases when a choice must be made. For e.g., if there is more than one steepest downslope neighbors, or there is none (flat areas). I believe these choices are not be documented (proprietary?) for Arc.

-Laura

On Feb 27, 2006, at 9:48 PM, Dylan Beaudette wrote:

On Monday 27 February 2006 05:31 pm, Jonathan Greenberg wrote:

I'm trying to replicate preparation of data for the DHSVM hydro model in
GRASS following an AML script, and I'm a bit confused why every GRASS
module with flow direction computation produces a different output than the
ARC one -- they even differ between themselves (e.g. r.watershed and
r.terraflow). Does anyone know of a flow direction computation that
produces the EXACT same outputs as ARC? I'm not "judging" which one is
better, I'm just trying to follow as closely as possible the first time
around the "idealized" algorithm.

--j

Good questions -- tough answers. I would be sceptical of suggesting that the
Arc-derived output is any better... but to the real subject:

Can you provide more information on the "type" of flow model used by the Arc
AML script? i.e. is it using D4,D8,Rho8,FRho8,DEMON,D-INF flow calculation?

note that D4,D8, and Rho8 are SFD (single input flow direction - single
output)
FD8,FRho8 are MFD (multiple input flow direction - single output)
DEMON and D-INF are similar in many ways, but not identical (multiple input
multiple output?) [1]

Each one of these different treatments of adjacent cells will influence the
output flow map/

Some examples in GRASS see man pages for each command

1. simplest case of the D8 flow direction, stored in new raster dir_d8 :
r.fill.dir in=elev_meters elev=e_filled direction=dir_d8

note that direction can be in the form of 0-360 or 1-8

2. example of the D-INF algorithm (vector output stored in new vector flow)
r.flow elevin=e_filled aspin=aspect flout=flow

3. example of MFD aka FRho8 :
r.terraflow....

note that the direction output will be from 0-255

[1] Wilson and Gallant. Terrain Analysis. 2000

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

An additional complicating factor in flow direction calculations is the processing of the DEM -- that is, in general you will perform a fill operation to fill local pits in the dataset. The implementation of fill differs, and can cause drastically different flow direction generation.

That said, ARC uses a single-flow D8 algorithm, with direction encoded as a binary angle (1,2...128). The algorithm is described in the ESRI help documentation [1]. In the case of more than one steepest neighbor, it generates a lookup table for the most likely direction. In flat areas, a sink is defined. If sinks are left unfilled, they stop the flow of water, and water is not routed beyond these locations. The cited source for the implementation of FLOWDIRECTION is [2] [3], and also [4].

From my uses of various flow routing algorithms, I've found the ARC implementation has a cardinal direction bias, and this is documented by others [5]. I'd guess that with some small changes to r.watershed following the rules set forth in the help documentation [1], you can probably get it to faithfully emulate the ARC flow direction. In general, flow direction is an idealization which is a fairly blunt tool for measuring the nature of flow over a surface, and some differences between implementations should be expected.

1. http://webhelp.esri.com/arcgisdesktop/9.1/body.cfm?tocVisable=0&ID=2951&TopicName=flow%20direction
2. http://edna.usgs.gov/Edna/pubs/extractingtopographicstructure1.pdf
3. Jenson S. K. and J. O. Domingue. 1988. Extracting Topographic Structure from Digital Elevation Data for Geographic Information System Analysis, Photogrammetric Engineering and Remote Sensing. Vol. 54, No. 11, November 1988, pp. 1593-1600.
4. Greenlee D. D. 1987. Raster and Vector Processing for Scanned Linework, Photogrammetric Engineering and Remote Sensing. Vol. 53, No. 10, October 1987, pp. 1383-1387.
5. http://www.crwr.utexas.edu/reports/2000/rpt00-1.shtml (pages 35-38)

- Shaun Walbridge

Laura Toma wrote:

It is hard to produce identical outputs for single-flow-direction models, because of the cases when a choice must be made. For e.g., if there is more than one steepest downslope neighbors, or there is none (flat areas). I believe these choices are not be documented (proprietary?) for Arc.

-Laura

On Feb 27, 2006, at 9:48 PM, Dylan Beaudette wrote:

On Monday 27 February 2006 05:31 pm, Jonathan Greenberg wrote:

I'm trying to replicate preparation of data for the DHSVM hydro model in
GRASS following an AML script, and I'm a bit confused why every GRASS
module with flow direction computation produces a different output than the
ARC one -- they even differ between themselves (e.g. r.watershed and
r.terraflow). Does anyone know of a flow direction computation that
produces the EXACT same outputs as ARC? I'm not "judging" which one is
better, I'm just trying to follow as closely as possible the first time
around the "idealized" algorithm.

--j

Good questions -- tough answers. I would be sceptical of suggesting that the
Arc-derived output is any better... but to the real subject:

Can you provide more information on the "type" of flow model used by the Arc
AML script? i.e. is it using D4,D8,Rho8,FRho8,DEMON,D-INF flow calculation?

note that D4,D8, and Rho8 are SFD (single input flow direction - single
output)
FD8,FRho8 are MFD (multiple input flow direction - single output)
DEMON and D-INF are similar in many ways, but not identical (multiple input
multiple output?) [1]

Each one of these different treatments of adjacent cells will influence the
output flow map/

Some examples in GRASS see man pages for each command

1. simplest case of the D8 flow direction, stored in new raster dir_d8 :
r.fill.dir in=elev_meters elev=e_filled direction=dir_d8

note that direction can be in the form of 0-360 or 1-8

2. example of the D-INF algorithm (vector output stored in new vector flow)
r.flow elevin=e_filled aspin=aspect flout=flow

3. example of MFD aka FRho8 :
r.terraflow....

note that the direction output will be from 0-255

[1] Wilson and Gallant. Terrain Analysis. 2000

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

Some examples in GRASS see man pages for each command

1. simplest case of the D8 flow direction, stored in new raster dir_d8 :
r.fill.dir in=elev_meters elev=e_filled direction=dir_d8

note that direction can be in the form of 0-360 or 1-8

2. example of the D-INF algorithm (vector output stored in new vector
flow) r.flow elevin=e_filled aspin=aspect flout=flow

be sure to visualize with d.rast.arrow too (version in grass 6.1-cvs).

also you might want to check out the (somewhat redundant in hindsight)
dominant_dir.m and calc_terraflow_dir.m scripts on the Wiki add-ons
page for reducing MFD to D-8.
http://grass.gdf-hannover.de/twiki/bin/view/GRASS/GrassAddOns#Raster_add_ons

Hamish