[GRASS-dev] Wrong direction in r.watershed slope length calculation?

josten at abo.fi josten at abo.fi
Mon Apr 8 02:44:18 PDT 2013


I discovered the following in r.watershed/ram/slope_len.c where the  
slope length is calculated given two cell positions in the raster.

if (r == dr)
     res = window.ns_res;
else if (c == dc)
     res = window.ew_res;
else
     res = diag;

Here we are dealing with a cell given by coordinates (r,c) which flows  
into another cell (dr,dc). So the code reads to me that if the two  
cells are on the same row, add to the slope the map's North-South  
resolution. Should it not be West-East since the slope is horizontal  
rather than vertical and vice versa for the columns?

This seems like a bug to me and the code is taken from the latest snapshot.

Johan Sten




More information about the grass-dev mailing list