This function modifies a habitat matrix to increase the cover of a specified category (swfCat) by clumping it within a defined kernel size, considering neighbor preferences and optionally reducing the selection by a given factor.

swf.molder(
  Hmatrix,
  swfCover = 0.1,
  swfCat,
  agriCat,
  Q,
  ExpPriority = "mixed",
  ExpDirection = "orthogonal",
  reduceTo = 0,
  iterations = 20,
  kernelCl = 20,
  kernelRw = 20,
  NNeighbors = 0,
  maxDistance = 1,
  queensCase = FALSE,
  maxGDistance = NULL,
  np = 1,
  deBug = FALSE
)

Arguments

Hmatrix

A matrix representing the initial habitat state.

swfCover

The desired cover proportion for the swfCat category.

swfCat

The category value in the matrix to be increased.

agriCat

The category value in the matrix considered as non-habitat.

Q

The number of cells to be potentially modified in each iteration.

reduceTo

A factor by which to reduce the selection of cells during processing.

iterations

The number of iterations to run the modification process.

kernelCl

The number of columns in the kernel (clumping window).

kernelRw

The number of rows in the kernel (clumping window).

NNeighbors

The number of neighbor cells to consider for potential habitat clumping.

maxDistance

The maximum distance to look for neighbor cells.

queensCase

Logical; if TRUE, considers all 8 directions for neighbors; if FALSE, only orthogonal.

np

Number of cores for parallel processing.

deBug

Logical; if TRUE, prints debugging information during processing.

ExpDir

Function to determine the prioritization of diagonal neighbors.

Value

A list of matrices representing the state of the habitat matrix after each iteration.