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

Glynn Clements glynn at gclements.plus.com
Fri Aug 11 20:17:16 EDT 2006


Maciej Sieczka 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.

First, r.bilinear reads the input map as integer CELL values
(G_get_c_raster_row).

Second, it adds 0.5 to the interpolated result, then writes the output
map as FCELL. I would guess that the 0.5 is because it originally
rounded to the nearest integer.

If the output mostly or wholly contains values with a fractional part
of 0.5, that suggests that the sample coordinates are falling exactly
on the cell centres, so the u and t interpolation fractions are zero,
resulting in the output value being an integer input value plus 0.5.

Changing it to read the input as FCELL or DCELL rather than CELL would
be trivial. I'll commit a patch to do that (read and write DCELL), as
well as remove the +0.5.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list