Glynn Clements pisze:
Jasiewicz Jarosław wrote:

while I need annulus (or torus) neighbor to some of my work I added easily it to neighbors (grass 65 delev) module. Because I do not won't to create a fork of that module I put it on that url:

If you need neighbourhood shape other than a square or circle, use the
weights= option.

Masks can be created using NumPy; e.g.

        from numpy import *
        r = 7           # outer radius
        r0 = 3          # inner radius
        d = sqrt(fromfunction(lambda x, y: (x-r)**2 + (y-r)**2, (2*r+1, 2*r+1)))
        m = logical_and(d >= r0, d <= r)
        savetxt('weights', m, fmt = '%d')

Or for smooth edges:

        from numpy import *
        r = 7           # outer radius
        r0 = 3          # inner radius
        d = sqrt(fromfunction(lambda x, y: (x-r)**2 + (y-r)**2, (2*r+1, 2*r+1)))
        m = minimum(1, maximum(0, (r-r0)/2 - abs(d - (r+r0)/2)))
        savetxt('weights', m, fmt = '% .3f')

If you only need a mask (weights of 0 or 1), you can use anything
which can outupt PGM files (use the P2 "text" format and cut off the
header).

yes, but for me modification of C code was little simpler than this.
cheers
Jarek
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to