[GRASS-dev] r.resamp.stats error
wegmann at biozentrum.uni-wuerzburg.de
Thu Dec 7 08:52:58 CET 2006
great, very fast response time!
thanks a lot!
On Thursday 07 December 2006 07:03, Glynn Clements wrote:
> Martin Wegmann wrote:
> > I found a weird behaviour in r.resamp.stats which causes a shift of the
> > resulting image but only on a large scale (subcontinental scale, shift to
> > south-west).
> > I tried to reproduce it with the spearfish dataset but failed.
> > Doing it on Africa srtm DEM (res based on gtopo30 DEM):
> > g.region -g
> > ...
> > res=0.00083333
> > ..
> > g.region res=0.0083333
> > r.resamp.stats input=dem output=dem_resampstats method=average
> > produces this output of a small region with islands shown in the jpg
> > (overlay with original raster)
> > any idea how to fix this? regards, Martin
> --- raster/r.resamp.stats/main.c 15 Nov 2006 03:57:24 -0000 1.8
> +++ raster/r.resamp.stats/main.c 7 Dec 2006 05:59:11 -0000
> @@ -80,13 +80,13 @@
> for (col = 0; col <= dst_w.cols; col++)
> double x = G_col_to_easting(col, &dst_w);
> - col_map[col] = (int) floor(G_easting_to_col(x + 0.5, &src_w));
> + col_map[col] = (int) floor(G_easting_to_col(x, &src_w) + 0.5);
> for (row = 0; row <= dst_w.rows; row++)
> double y = G_row_to_northing(row, &dst_w);
> - row_map[row] = (int) floor(G_northing_to_row(y + 0.5, &src_w));
> + row_map[row] = (int) floor(G_northing_to_row(y, &src_w) + 0.5);
> Instead of adding half a cell (to locate the midpoint rather than the
> north-west corner), I was adding half a map unit.
> For a projected location, the offset was half a metre (or foot), which
> is negligible. For a lat-lon location, the offset was half a degree,
> which is rather more significant.
> Fixed in CVS.
More information about the grass-dev