[GRASS5] Re: [GRASS-CVS] cho: grass51/raster/r.in.gdal main.c,1.6,1.7

The 'depths' is copy-paste of rows/cols. I don't know why cellhd->tb_res/2.0, but it was always there and it works, so I think
to keep adj_cellhd.c as it is, but init in modules to

    cellhd.top = 1.;
    cellhd.bottom = 0.;
    cellhd.tb_res = 1.;
  cellhd.depths = 1;

Radim

Markus Neteler wrote:

On Fri, Feb 11, 2005 at 11:33:31AM -0600, Huidae Cho wrote:

I got 1.5 from the code in lib/gis/adj_cellhd.c 249th line:

cellhd->depths = (cellhd->top - cellhd->bottom + cellhd->tb_res/2.0) /
cellhd->tb_res;

1.5 = (1.0 - 0.0 + 1.0/2.0) / 1.0

But, when writing WIND file, 1 is written by printf "%d", so depths can
be 1. At the time of bug fixing, I just followed theoretical
calculation.

Huidae Cho

Mhhh, maybe you are right. I cc to Radim for final inspection. He changed a lot of code
recently, so he may know better than me.

Sorry for any confusion (which might be mine).

Thanks for the quick fix of r.topidx

Markus

On Fri, Feb 11, 2005 at 12:02:10PM +0100, Markus Neteler wrote:

Hi Huidae,

thanks for the fix. But shouldn't htese numbers not be 1.0?

top - bottom 1 - 0 = 1

dres=1

So depth is also 1.0 IMHO?

What do your think?

Markus

On Fri, Feb 11, 2005 at 10:05:46AM +0100, grass@intevation.de wrote:

Author: cho

Update of /grassrepository/grass51/raster/r.in.gdal
In directory doto:/tmp/cvs-serv31089

Modified Files:
main.c Log Message:
Added cellhd.depths to avoid garbage number

Index: main.c

RCS file: /grassrepository/grass51/raster/r.in.gdal/main.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- main.c 15 Jan 2005 11:18:13 -0000 1.6
+++ main.c 11 Feb 2005 09:05:44 -0000 1.7
@@ -219,6 +219,7 @@
  cellhd.top = 1.;
  cellhd.bottom = 0.;
  cellhd.tb_res = 1.;
+ cellhd.depths = 1.5;
    }
    else
    {
@@ -241,6 +242,7 @@
    cellhd.top = 1.;
    cellhd.bottom = 0.;
    cellhd.tb_res = 1.;
+ cellhd.depths = 1.5;
        }
        else
        {
@@ -257,7 +259,7 @@
    cellhd.top = 1.;
    cellhd.bottom = 0.;
    cellhd.tb_res = 1.;
-
+ cellhd.depths = 1.5;
        }
    }

_______________________________________________
grass-commit mailing list
grass-commit@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-commit

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy