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

Daniel Victoria daniel_victoria at yahoo.com
Mon Feb 16 07:54:45 EST 2004


Hi all,

This would work fine if I had only one attribute for
each site, but I have more than one so I'd need a
placeholder for the places with no data. Or, my
workaround was to use one sites file for each
attribute and not import the points with no data...
works fine...

But this is what I noticed.
Since I'm importing the sites into GRASS with
s.in.ascii, I tried - with no success - put a string
(NODATA) as a placeholder but s.in.ascii switched the
string around and put it at the end of the sites
attribute line... Is this normal behavior or am I
going crazy?

This is what happened. The text input file:
-60,-18,NULL,1995,1,1,852450,Santa cruz/el tromp

The sites file:
60W|18S|#1 %1995 %1 %1 %852450 @NULL ....

As you can see, the year became the first fiels and
the NULL whent to the end of the line

Daniel



--- Paul Kelly <paul-grass at stjohnspoint.co.uk> wrote:
> 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
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html




More information about the grass-user mailing list