[GRASS-user] Re: r.surf.nnbathy interpolation to whole region

Maciej Sieczka tutey at o2.pl
Thu Sep 6 15:36:29 EDT 2007


>> Maciek wrote
> Carlos "Guâno" Grohmann wrote:

>>  Since nnbathy is cell-center oriented each
>> N,S,E,W extent has to be shifted half a current GRASS region resolution
>> to avoid it's output missalignment with current GRASS region.

> I always though that GRASS was cell-center oriented..

What do you mean?

Explanation of why the shift in r.surf.nnbathy in necessary:

The region:

$ g.region -g
n=404456
s=404453
w=315942
e=315945
nsres=1
ewres=1
rows=3
cols=3
cells=9

The input raster (* stands for null):

315942.5 404455.5 20
315943.5 404455.5 74
315944.5 404455.5 43
315942.5 404454.5 29
315943.5 404454.5 *
315944.5 404454.5 65
315942.5 404453.5 25
315943.5 404453.5 25
315944.5 404453.5 49

If the half-a-resolution shift IS applied (nnbathy -W 0 -P alg=nn -n
3x3 -x 315942.5 315944.5 -y 404455.5 404453.5), as described in
previous post, the output of r.surf.nnbathy in=xxx out=yyy is alligned
to the input raster:

315942.5 404455.5 20
315943.5 404455.5 74
315944.5 404455.5 43
315942.5 404454.5 29
315943.5 404454.5 48.25
315944.5 404454.5 65
315942.5 404453.5 25
315943.5 404453.5 25
315944.5 404453.5 49

If the shift IS NOT applied (nnbathy -W 0 -P alg=nn -n 3x3 -x 315942
315945 -y 404456 404453), the output is missaligned and interpolated
wrong, due to nnbathy working region set wrong:

315942 404456 NaN
315943.5 404456 NaN
315945 404456 NaN
315942 404454.5 NaN
315943.5 404454.5 48.25
315945 404454.5 NaN
315942 404453 NaN
315943.5 404453 NaN
315945 404453 NaN

Maciek




More information about the grass-user mailing list