[EMAIL PROTECTED] wrote:

> Sorry, I am a beginner... what shall I do with this gather-circle.c?

Replace raster/r.neighbors/gather.c with the new file, re-compile,
install the modified r.neighbors as e.g. r.neighbors.circle.

If you don't have the source code or can't figure out how to make the
necessary changes, you'll need to wait until someone integrates it
into GRASS.

Alternatively, you could use r.mapcalc, but if your circle is large,
this is going to require a large expression. You would probably want
to use a script to generate it, e.g.:

#!/usr/bin/python
# example usage: python circle.py | r.mapcalc

size = 9

dist = size / 2

n = 0
cmd = "out.avg = ("
for i in range(-dist,dist+1):
    for j in range(-dist,dist+1):
        if i**2 + j**2 <= dist**2:
            if n > 0:
                cmd = cmd + " + "
            cmd = cmd + "inmap[" + str(i) + "," + str(j) + "]"
            n=n+1
cmd = cmd + ") / " + str(n)
print cmd

n = 0
cmd = "out.min = min("
for i in range(-dist,dist+1):
    for j in range(-dist,dist+1):
        if i**2 + j**2 <= dist**2:
            if n > 0:
                cmd = cmd + ", "
            cmd = cmd + "inmap[" + str(i) + "," + str(j) + "]"
            n=n+1
cmd = cmd + ")"
print cmd

n = 0
cmd = "out.max = max("
for i in range(-dist,dist+1):
    for j in range(-dist,dist+1):
        if i**2 + j**2 <= dist**2:
            if n > 0:
                cmd = cmd + ", "
            cmd = cmd + "inmap[" + str(i) + "," + str(j) + "]"
            n=n+1
cmd = cmd + ")"
print cmd

-- 
Glynn Clements <[EMAIL PROTECTED]>

_______________________________________________
grassuser mailing list
[email protected]
http://grass.itc.it/mailman/listinfo/grassuser

Reply via email to