[GRASSLIST:2642] Re: interpolation of area precipitation with s.surf.idw

Paul Kelly paul-grass at stjohnspoint.co.uk
Mon Feb 16 07:26:01 EST 2004


Hello Daniel

On Mon, 16 Feb 2004, Daniel Victoria wrote:

> Of course, if there where a nodata value for sites, we
> could use only one site file for all data, but I don't
> know if there is such thing...

Well, you can make a line in the site_lists file that has only an easting
and northing and no attribute, something like:

1|1| %2
1|2|
2|1| %2
2|2| %2

where the site at easting=1 northing=2 has no data, but the way it is
treated will depend on the GRASS module used.

The following patch to s.surf.idw will allow it to continue on past the
missing data line and read all the sites:

Index: read_sites.c
===================================================================
RCS file: /grassrepository/grass/src/sites/s.surf.idw/cmd/read_sites.c,v
retrieving revision 1.4
diff -u -r1.4 read_sites.c
--- read_sites.c	10 Apr 2003 13:08:20 -0000	1.4
+++ read_sites.c	16 Feb 2004 12:22:17 -0000
@@ -50,7 +50,7 @@
       G_warning("I'm finding records that do not have a floating point attributes (fields prefixed with '%').");
     }

-    while (G_site_get(fd, site) >= 0)
+    while (G_site_get(fd, site) != EOF)
     {
 	newpoint(site->dbl_att[field],site->east,site->north);
         if(!(npoints%1000))

but I don't think it's the way forward; just a quick hack to get around
this problem. Maybe G_readsites_xyz() holds some clues to a better way to
read sites files. I have never really looked at it and must do so
some time.

Paul




More information about the grass-user mailing list