Or have I completely misunderstood something now? As a programmer I took it for granted that the row number would change if I traversed the map up and down in the program along the North-South axis while the columns would change when I traversed the map sideways from west to east. In the raster, the (0,0) coordinate would represent the north-western-most cell, with values increasing towards the south-east.

And this fact seems supported by the following line taken from init_vars.c:

max_length = 10 * nrows * window.ns_res + 10 * ncols * window.ew_res;

But then I found this in the code for calculating the length of the slope for a given cell in slope_len.c:

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

if (top_ls == half_res) // half_res = initialization value
    top_ls = res;
    top_ls += res;

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?

Either I misunderstand how the length is calculated or this seems like a bug in the program for me. Also on quadratic cell sizes this will not be noticeable but it is important that I get it right for other cases.

  • 1
    Please tell us which GRASS version you are looking at. Furthermore, let me recommend the grass-dev mailing list for the question (grass.osgeo.org/support/mailing-lists)
    – markusN
    Apr 3, 2013 at 16:55
  • 6.4.2 Stable Release. This code is still present in the latest Grass 7 snapshot created last Sunday.
    – Steinin
    Apr 4, 2013 at 6:24
  • OK, so please contact either the author or better, the indicated developers mailing list...
    – markusN
    Apr 4, 2013 at 16:09
  • I've sent this question to the GRASS Developers mailing list.
    – Steinin
    Apr 5, 2013 at 10:01
  • Actually I don't see it: lists.osgeo.org/pipermail/grass-dev/2013-April/date.html Note that you need to subscribe to post there... (to avoid spam messages).
    – markusN
    Apr 5, 2013 at 18:33

1 Answer 1


Confirmed as bug and fixed by developers in new version.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.