[GRASS-user] interpolating data points

Michael Perdue michael_perdue at yahoo.ca
Tue Nov 28 15:56:36 EST 2006


On 28-Nov-06, at 12:51 PM, Paul Pick wrote:

>> 2. Set region bounds such that the bounds are on 0.25 degree interval
>> with 0.5 degree resolution. That should put the pixel centers on the
>> 1/2 degree interval that your looking for.
>
>  I'm not sure what you mean by interval vs resolution. I use
> 'g.region -a vect=v_interp_data res="00:20"' to set a 20
> second resolution (as I think a 20 second res will put the
> pixel centres at 0.5 degrees). How would you propose that
> I modify that?

You'll want the boundary on the quarter second interval and the  
resolution set to 1/2 second interval. IE, something like this;

GRASS 6.2.0 (newLocation):~ > g.region n=50:15:00N s=49:15:00N  
e=110:15:00W w=111:45:00W nsres=00:30:00 ewres=00:30:00
GRASS 6.2.0 (newLocation):~ > g.region -p
	projection: 3 (Latitude-Longitude)
	zone:       0
	datum:      towgs84=0,0,0,0,0,0,0
	ellipsoid:  a=6378137 es=0.006694380022900787
	north:      50:15N
	south:      49:15N
	west:       111:45W
	east:       110:15W
	nsres:      0:30
	ewres:      0:30
	rows:       2
	cols:       3
	cells:      6


This grid will have it's pixel centers on the 30min interval.


>
>> 3. v.surf.* to interpolate your grid.
>
>  This is where the process spends the vast majority of its
> time. Perhaps your 'interval 0.25, resolution 0.5' can speed
> this along.

Yes, interpolation is always a intensive task and from what I  
remember of my exeriences in GRASS, r.surf.idw is one of the faster  
modules. Alternately, you might want to try r.surf.nnbathy script  
that is in the addon section of the wiki pages. I think it uses  
Shewchuk's triangle algorithm, and if it's anything like GMT's  
implementation, it is very very fast. However, I have never used so I  
can't say for sure.

>
>> 4. r.out.xyz to export each pixel to a xyz ascii triplet.
>
>  Ah, I didn't know r.out.xyz existed (I'm using 6.2 and
> it appears to be present only in 6.3). That looks like
> it would simplify my script quite a bit. Unfortunately,
> it would not necessarily decrease the execution time.

Ah... didn't realize that either. If you have GMT you can accomplish  
the same thing in two steps using triangulate (or surface but  
triangulate is 10x faster with Shewchuk's library) and grd2xyz.

triangulate samples.xyz  −R-114/-110/49/60 −I30m −Gfoobar.grd > / 
dev/null
grd2xyz foobar.grd > interplolated.xyz

Note that GMT is grid line registed rather than pixel center  
registered. Also, you'll have to play with your gmt settings to get  
the proper output format.

Cheers,

Mike

>
>  Thanks,
>  - Paul
>
> -- 
> Paul Pick <paul.pick at ec.gc.ca>
> Informatics Services Unit Gagetown
> Chief Information Officer Branch, Environment Canada
> [CSN] 432 2082 [CIV] 506 422 2000 x 2082 [FAX] 506 422 1443

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the grass-user mailing list