[GRASS-dev] r.watershed and flow directions

Helena Mitasova hmitaso at unity.ncsu.edu
Thu Mar 27 11:19:03 EDT 2008

On Mar 26, 2008, at 8:31 PM, Andrew Danner wrote:

> Luca,
>  The Terrastream direction coding for single flow direction is as
> follows
> 1 = Water flows east
> 2 = SE
> 4 = S
> 8 = SW
> 16 = W
> 32 = NW
> 64 = N
> 128 = NE
> Or pictorially
>  32  64 128
>  16   x  1
>   8   4  2
> In the MFD case, values do NOT represent aspects in the range 0 to  
> 360,
> but instead indicate sums of the directions above. Thus if water flows
> N, S and SW, the value is 64+8+4 = 76.
> In both the SFD/MFD outputs, a value of 0 means this point is local
> minimum and there is no flow direction.
> r.water.outlet reports:
> drainage=name
>         Input map: drainage direction. Indicates the "aspect" for each
>         cell. Multiplying positive values by 45 will give the  
> direction
>         in degrees that the surface runoff will travel from that cell.
>         The value -1 indicates that the cell is a depression area.  
> Other
>         negative values indicate that surface runoff is leaving the
>         boundaries of the current geographic region. The absolute  
> value
>         of these negative cells indicates the direction of flow. This
>         map is generated from r.watershed
> I don't know if the direction it refers to is measured from North or
> East or if it moves clockwise or counterclockwise.
> r.slope.aspect measures ccw from east, TerraStream and TerraFlow are
> measuring clockwise from East, and standard compass direction is
> measured clockwise from North.
> If someone is more familiar with the r.water.outlet drainage  
> directions,
> it should be relatively easy to map the values 1,2,4,8,16,32,64 and  
> 128
> to 1 through 7.  log_2(tflow_dir)+1 will map terrastream flow  
> directions
> onto the range 1-7 (handling 0 is special case).
> Is there any consistent way of encoding flow direction?   
> TerraStream and
> TerraFlow I believe used an encoding from Jenson and Domingue,  
> though in
> looking up their reference they started with 1 in the NE and moved
> clockwise. Perhaps ESRI products used 1=E. It seems that aspect should
> be measured clockwise in degrees from north geographically, but it  
> makes
> more sense to measure ccw from east trigonometrically.

sometimes in early 90ies decision was made for GRASS to follow  
approach with ccw from east for aspect
- so r.slope.aspect, v..surf.rst, r.flow and in fact r.watershed  
follow that rule
(r.watershed has 1 NE which is 45 deg and grows ccw (if anybody finds  
that this is not the
case please let me know - I will modify the man pages accordingly)).

I looked into yet unpublished Geomorphometry book that has a ton of  
info about
flow direction and softwares that compute it, but it mentions what  
the numbers actually
mean in only one place
suggesting that aspect is usually measured cw from north (compass  
It seems to me that 1 in the NE growing cw is essentially a D8  
version of starting
North, having 45deg at NE - so that would be the compass direction  
used by Jensen?
> TerraStream could easily rotate or reverse the values 1-255 if  
> there is
> a standard out there to follow.

After digging through some literature, I would say there is no  
official standard
but for GRASS implementation it would make
sense to follow ccw from east with 1 (45deg) at NE.
Compass approach with 1 (45deg) at NE and growing cw would work too  
for general
audience. Other versions look rather non-standard to me.
Whatever is chosen, apparently it is necessary to have this  
documented in man pages.

Unrelated to this issue - it would be great to include the option of  
delineating watershed boundaries
from given points into Terrastream and/or r.terraflow. It is a very  
common task - e.g. you
need to compute % impervious areas upslope from a monitoring stations  
or sampling
site (they can be hundreds  of them).

> -Andy
> On Thu, 2008-03-27 at 00:49 +0100, Luca Casagrande wrote:
>> Hello everybody.
>> While Ivan is working on r.watershed I am trying to reach the result
>> using TerraSTREAM.
>> With the help of Thomas, I have successfully created a drainage map
>> from the DEM and the idea is to use it
>> with r.water.outlet. The problem is that it needs a drainage map with
>> values that run from -8 to 8, instead TerraSTREAM prompt out a bitmap
>> (using SFD) or a raster with values from 0 to 360 degree (with  
>> MFD). I
>> can reclass it with r.reclass
>> but I don't know how handle negative values.
>> Any suggestion on this?
>> Thanks
>> Luca
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev

More information about the grass-dev mailing list