Need an algorithm to identify spatial clusters
Hi Mark, What you are looking for is a connected component algorithm. The algorithm should receive a binary matrix (i.e. 0's and 1's for fire/no fire) and delineate isolated groups of pixels following either a 4 or 8 neighbor rule. Some time ago I coded a function to do this (I couldn't find a package with this functionality), and I would be happy to pass it along. My function wasn't extremely efficient but worked well enough to process thousand of matrices (each 100x100) in a relatively short time. Let me know if you need it. Julian Burgos, PhD University of Washington
On Tue, 14 Apr 2009, Mark Andersen wrote:
Hello, all,
I am currently interested in simulating the initiation and spread of forest
fires in simulated landscapes consisting of 2 tree species (a native and an
invasive). I'm simulating fire seasons of fixed length; fires can start at any
time and in either tree species during this fire season, and spread through the
simulated forest according to a simple percolation-like process. I have
developed the algorithms for this in Matlab, and don't anticipate any problems
converting them to R if I need to.
However, it's the next task that has me at a loss. At the end of each fire
season, there will be several burned patches on the simulated landscape; the
number of these patches won't necessarily correspond to the total number of
fires that season, because fires may coalesce. I need to count how many of
these burned patches there are, and find the size of each. It seems that there
should be an algorithm available to do this, but I haven't found one, possibly
because I haven't been using the right search criteria. I used
RSiteSearch("spatial cluster"), and got many references to the spatclus
package. However, from the spatclus documentation it appears that this is not
quite what I'm looking for. Spatclus looks like it picks out potential clusters
of occurrence of some phenomenon (such as earthqukes or cancer); I need
something that will delineate clusters of contiguous pixels with the same value
(i.e., burned in my simulations). Could anyone point me towards such an
algorithm, or help me get started finding one?
--
Dr. Mark C. Andersen, Professor
Department of Fish, Wildlife, and Conservation Ecology
New Mexico State University
Las Cruces, NM 88003
575-646-8034
fax: 575-646-1281
web: web.nmsu.edu/~manderse
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology