[GRASS-user] integration of sample.c algorithms into r.resample

Dylan Beaudette dylan.beaudette at gmail.com
Sun Aug 13 22:08:45 EDT 2006


On Friday 11 August 2006 20:45, Glynn Clements wrote:
> Dylan Beaudette wrote:
> > > > 1. the output is not quite correct when the region is not aligned to
> > > > the input raster, including edge effects
> > >
> > > Actually r.bilinear is all screwed:
> > > http://intevation.de/rt/webrt?serial_num=2790
> > > There are two issues. Please see my most recent posts and Urs Gruber's
> > > post dated Tue, Feb 14 2006 17:16:21.
> >
> > Hehe - I was waiting for you to chime in with that bug ! Indeed. Looking
> > through r.bilinear there are a lot of (data + 0.5) operations that I
> > don't quite understand -- my limited ability or small errors: not
> > completely sure.
> >
> > > It would be great to have r.bilinear fixed and all algorithms merged
> > > into one command. Good luck!
> >
> > Sure. Well - with Glynn's help on the rowio library -- I am hoping on
> > fixing sample.c so that it uses row caching and verify that NULL support
> > is correctly done. Then, it would be a matter of calling the sample.c
> > algorithms at each new grid cell.
> >
> > I would like to get this done, but it may take a little while. Any help
> > would be great.
>
> I've attached a modified version of r.bilinear which does
> nearest-neighbour, bilinear and bicubic interpolation. It's only been
> lightly tested, but the case where the source and destination regions
> match (exact copy) has been tested. It could use some testing at more
> extreme scale factors.
>
> It would be possible to speed it up a bit, at the expense of
> simplicity, by caching the horizontal interpolates for each row.
> However, even in its present form, it's still likely to be a lot
> faster than using the functions in sample.c.

Very nice! much faster than anything I could have prototyped. This version 
appears to work well with extreme sale factors, however i noticed one 
possible problem.

When I use your new version of r.bilinear method=nearest on a CELL image, the 
output is DCELL. While this can be fixed with r.mapcalc it shouldn't be too 
hard to add this to the new module (?) .

other than that, great work!

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list