create_hab: Create habitat distribution fields

create_habR Documentation

Create habitat distribution fields

Description

create_hab parametrises and returns the spatial fields used for the distribution of suitable habitat for the populations in the simulation.

The spatial fields are generated using RFsimulate function from the RandomFields package.

Usage

create_hab(
  sim_init = sim,
  seed = 123,
  spp.ctrl = NULL,
  spawn_areas = NULL,
  spwn_mult = 10,
  plot.dist = FALSE,
  plot.file = getwd()
)

Arguments

spp.ctrl

List of controls to generate suitable habitat for each species. Must be of the form spp.ctrl = list(spp.1 = c(var = 20, ...), spp.2 = c(var = 10, ..),..) and contain the following:

  • nu (>=0)

  • var (>=0) Controls the range in a matern covariance

  • scale (>=0)

  • Aniso (matrix, dim = c(2,2))

plot.dist

Boolean, whether to plot the distributions to file

plot.file

path to save the plots of the species distributions

sim

is the parameter settings for the simulation, made by init_sim function.

Value

Silently returns a list of spatial distributions of suitable habitat with first level of the list being the population (1 -> n.spp). If plot.dist = TRUE it produces an image of the spatial distributions at each time step for each of the populations saved to the working directory (unless specified otherwise in plot.file)

Examples

hab <- create_hab(sim.init = sim.init, spp.ctrl = list(
      'spp.1' = list('nu' = 1/0.15, var = 1, scale = 10, Aniso =
      matrix(nc=2, c(1.5, 3, -3, 4)))), spawn_areas = list("spp1" =
      list("area1" = c(2,4,6,8))), list("spp2" = list("area1" =
      c(0,10,23,35))), spwn_mult = 10, plot.dist = TRUE, plot.file =   getwd())

pdolder/MixFishSim documentation built on Oct. 17, 2023, 4:25 p.m.