[GRASS-user] identifying diagonal clumps
maning sambale
emmanuel.sambale at gmail.com
Sun Sep 14 21:27:10 EDT 2008
I used to implement an r.mapcalc script by evaluating values in the
cardinal directions
sample below:
## pixels with both forest from the cardinal directions
# 0--x--0
# | | |
# x--x--x
# | | |
# 0--x--0
r.mapcalc "F4 = (A * A [1,0]) * (A * A [-1,0]) * (A * A [0,-1]) * (A * A [0,1])"
where [r,c] refers to the current cell offset
for an 8-rule you can use
[-1,-1],[-1,0],[1,-1],[0,-1],[0,1],[-1,1],[1,-1],-1,1]
hope that helps.
cheers,
maning
On 9/15/08, Milton Cezar Ribeiro <miltinho.astronauta at gmail.com> wrote:
> Dear all,
> I am using r.cluster to identify the clumps of pixels of my binary map
> (0=matrix and 1=habitat).
> But when I run r.cluster, I get and output cluster map as (B) (see below)
> and in fact
> I would like the those diaagonal patches were clumped as the same clump.
> Almost to those that work with landscape ecology, the patches are formed
> using rules with 8 neighbors intead of 4 neighbors.
>
> I know that I can do it on other programs, but I need to implement a
> sequence of
> codes on GRASS, and I really need a rule-8 to build my patches map. Any
> idea?
>
> Best wishes,
>
> miltinho astronauta
> brazil
>
> (A)
> 00000000
> 01000000
> 00110000
> 00110000
> 00001100
> 00001100
> 00001100
> 00000000
> (B)
> 00000000
> 01000000
> 00220000
> 00220000
> 00003300
> 00003300
> 00001100
> 00000000
>
--
|---------|----------------------------------------------------------|
| __.-._ |"Ohhh. Great warrior. Wars not make one great." -Yoda |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
| /'.-c |Linux registered user #402901, http://counter.li.org/ |
| | /T |http://esambale.wikispaces.com|
| _)_/LI
|---------|----------------------------------------------------------|
More information about the grass-user
mailing list