Hi Devs,
I have been using the v.mkgrid command extensively recently and noticed that the tables of the output differ depending on the grid size. Apart from not having the columns rown and coln, larger grids’ row column counts from bottom to top rather than top to bottom as with smaller grids. I have dug in the code and found the appropriate lines in the main.c:
I would call it a (undocumented) feature not a bug as it dates back to
initial revision of v.mkgrid.
Unfortunately I could not find the initial commit with a rationale
behind magical number 27. Earliest change I found was from 2004, when
Radim just commits v.mkgrid with message "upgrade". It is possible
that this feature(?) dates back to original version "Written by GRASS,
Fall of 88, Michael H." thus its original meaning seems to be lost.
I would suggest to go to trac and open a bug (with a patch,
preferably). Question, of course, is - which behaviour is the correct
one (count from bottom, count from top).
2015-11-28 0:14 GMT+02:00 Michel Wortmann <wortmann@pik-potsdam.de>:
Hi Devs,
I have been using the v.mkgrid command extensively recently and noticed that
the tables of the output differ depending on the grid size. Apart from not
having the columns rown and coln, larger grids’ row column counts from
bottom to top rather than top to bottom as with smaller grids. I have dug in
the code and found the appropriate lines in the main.c:
The magical number 27 comes from the fact that it puts letters into rown and coln and the alphabet is exhausted after 27 (although I wonder why the condition is && and not ||?). The inconsistency is just related to the counting of the row, i.e. the second argument to sprintf() in the else statement. So all thats needed is to replace the i + 1 with grid_info.num_rows - i.
I would call it a (undocumented) feature not a bug as it dates back to
initial revision of v.mkgrid.
Unfortunately I could not find the initial commit with a rationale
behind magical number 27. Earliest change I found was from 2004, when
Radim just commits v.mkgrid with message “upgrade”. It is possible
that this feature(?) dates back to original version “Written by GRASS,
Fall of 88, Michael H.” thus its original meaning seems to be lost.
I would suggest to go to trac and open a bug (with a patch,
preferably). Question, of course, is - which behaviour is the correct
one (count from bottom, count from top).
On Sat, Nov 28, 2015 at 11:24 AM, Michel Wortmann
<wortmann@pik-potsdam.de> wrote:
The magical number 27 comes from the fact that it puts letters into rown and
coln and the alphabet is exhausted after 27 (although I wonder why the
condition is && and not ||?). The inconsistency is just related to the
counting of the row, i.e. the second argument to sprintf() in the else
statement. So all thats needed is to replace the i + 1 with
grid_info.num_rows - i.
The magical number 27 comes from the fact that it puts letters into rown and
coln and the alphabet is exhausted after 27 (although I wonder why the
condition is && and not ||?). The inconsistency is just related to the
counting of the row, i.e. the second argument to sprintf() in the else
statement. So all thats needed is to replace the i + 1 with
grid_info.num_rows - i.