[GRASS-dev] r.watershed and swap memory

Andrew Danner adanner at cs.swarthmore.edu
Wed Mar 26 20:31:07 EDT 2008


 The Terrastream direction coding for single flow direction is as

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:
        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. 

TerraStream could easily rotate or reverse the values 1-255 if there is
a standard out there to follow.



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

More information about the grass-dev mailing list