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; else res = diag; if (top_ls == half_res) // half_res = initialization value top_ls = res; else 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.