findsmallpatches.grid: Function to identify cells that are part of small patches in...

View source: R/findsmallpatches.R

findsmallpatchesR Documentation

Function to identify cells that are part of small patches in a grid

Description

This function returns a grid of the same extent as x populated with TRUE and FALSE indicating whether each cells is part of a small patch and within one of the targetclasses

Usage

findsmallpatches(x, maxsize,  nr=8, ...)
## S3 method for class 'grid'
findsmallpatches(x, maxsize, nr = 8, ...)
## S3 method for class 'matrix'
findsmallpatches(x, maxsize, nr = 8,  targetclasses = NA,...)

Arguments

x

a grid object

nr

the neighbor rule to use when identifying small patches; should be either 4 or 8

maxsize

the maximum number of cells a patch can have and be considered small

targetclasses

a vector indicating classes to process; if set only cells in the target classes will be eligable to be identified as small; if NA all classes are considered.

...

arguments passed on to other methods

Value

This function returns a logical grid with TRUE anwhere a small patch exists within a target class and FALSE elsewhere.

Author(s)

Ethan Plunkett

See Also

eliminatesmallpatches uses this function to remove small patches and replace with values from nearby cells patchscan is used by this function to identify patches.

Examples


  g <- asgrid(matrix(runif(n = 48)> .7, 6, 8), xll = 0, yll = 0, cellsize = 10)
  plot(g)
  plot(findsmallpatches(g, 3, nr = 8)) # TRUE (1) where g has small patches



ethanplunkett/gridprocess documentation built on Feb. 1, 2024, 2:24 a.m.