[GRASS-user] eliminate isolated pixel groups - solved

Florian Kindl florian.kindl at uibk.ac.at
Thu Jan 18 15:05:05 EST 2007


Glynn,
thank you very much for your first-class help!
I made a good step forward with your advice.

I just wonder how you count 20 in step 3, though ;)

Thanks,
Florian


On Jan 17 [19:55], Glynn Clements wrote:
> 
> My first attempt would be:
> 
> 1. r.mapcalc "${RI}.null = isnull(${RI})"
> 
> 2. r.mfilter input=${RI}.null ouput=${RI}.count filter=ring5x5
> 
> where ring5x5 is:
> 
> 	TITLE	5x5 sum
> 	MATRIX	5
> 	1 1 1 1 1
> 	1 0 0 0 1
> 	1 0 0 0 1
> 	1 0 0 0 1
> 	1 1 1 1 1
> 	DIVISOR	1
> 	TYPE	P
> 
> 3. r.mapcalc "${RI}.ring = ${RI}.count == 20"
r.mapcalc "${RI}.ring = ${RI}.count == 16"
> 
> 4. r.mfilter input=${RI}.ring ouput=${RI}.change filter=box3x3
> 
> where box3x3 is:
> 
> 	TITLE	3x3 sum
> 	MATRIX	3
> 	1 1 1
> 	1 1 1
> 	1 1 1
> 	DIVISOR	1
> 	TYPE	P
> 
> 5. r.mapcalc "${RO} = if(${RI}.change,null(),${RI})"
> 
> 6. g.remove rast=${RI}.null,${RI}.count,${RI}.ring,${RI}.change
> 
> While you could use r.mapcalc instead of r.mfilter for steps 2 and 4,
> the r.mfilter approach scales more readily to larger windows.
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>
> 

-- 
Florian Kindl
Institute of Geography
University of Innsbruck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20070118/b32da706/attachment.bin


More information about the grass-user mailing list