[GRASS5] [bug #802] (grass) r.in.gdal: number of imported rows incorrect?

this bug's URL: http://intevation.de/rt/webrt?serial_num=802
-------------------------------------------------------------------------

Subject: r.in.gdal: number of imported rows incorrect?

grass downloaded at: CVS Server, Germany
grass sources source: yes, I am using the latest GRASS from CVS

Hi,

it seems that r.in.gdal uses an unusual row index
(src/raster/r.in.gdal/main.c):

for (row = 1; row <= nrows; row++)
    {

Usually the row number starts with 0.

Any ideas?

Thanks

Markus

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

it seems that r.in.gdal uses an unusual row index
(src/raster/r.in.gdal/main.c):

for (row = 1; row <= nrows; row++)
    {

Usually the row number starts with 0.

This isn't limited to r.in.gdal; there is other code in GRASS which
uses the Pascal convention for array indices (e.g. i.cca).

In the case of the above file, this means that the call to G_percent()
is wrong; the other references to "row" are as "row-1".

r.in.gdal is trivial to fix, as the issue is limited to this loop. I
didn't touch i.cca, as the one-based convention is used throughout.

--
Glynn Clements <glynn.clements@virgin.net>

Glynn Clements wrote:

> it seems that r.in.gdal uses an unusual row index
> (src/raster/r.in.gdal/main.c):
>
> for (row = 1; row <= nrows; row++)
> {
>
> Usually the row number starts with 0.

This isn't limited to r.in.gdal; there is other code in GRASS which
uses the Pascal convention for array indices (e.g. i.cca).

In the case of the above file, this means that the call to G_percent()
is wrong; the other references to "row" are as "row-1".

As Frank pointed out (a while back), this is actually correct; it
ensures that:

a) the reported percentages are correct (G_percent() is called at the
end of each pass), and

b) the final call to G_percent() reports 100% and prints a newline.

--
Glynn Clements <glynn.clements@virgin.net>