metaRangeEnvironment {metaRange}R Documentation

metaRangeEnvironment object

Description

Creates an metaRangeEnvironment object in form of an R6 class that stores and handles the environmental values that influence the species in the simulation.

Value

An ⁠<metaRangeEnvironment>⁠ object

Public fields

sourceSDS

A SpatRasterDataset created by terra::sds() that holds all the environmental values influencing the simulation. Note that the individual data sets should be sensibly named as their names will used throughout the simulation to refer to them.

current

an R environment that holds all the environmental values influencing the present time step of the simulation as regular 2D R matrices.

Methods

Public methods


Method new()

Creates a new metaRangeEnvironment object. This is done automatically when a simulation is created. No need to call this as user.

Usage
metaRangeEnvironment$new(sourceSDS = NULL)
Arguments
sourceSDS

⁠<SpatRasterDataset>⁠ created by terra::sds() that holds all the environmental values influencing the simulation. Note that the individual data sets should be sensibly named as their names will used throughout the simulation to refer to them.

Returns

An ⁠<metaRangeEnvironment>⁠ object

Examples
# Note: Only for illustration purposes.
env <- metaRangeEnvironment$new(sourceSDS = terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2)))
env

Method set_current()

Set current (active) time step / environment. No reason to call this as user. The current time step is set automatically.

Usage
metaRangeEnvironment$set_current(layer)
Arguments
layer

⁠<integer>⁠ layer

Returns

⁠<invisible self>⁠

Examples
# Only for illustration purposes.
sim_env <- terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2, nlyr = 2))
names(sim_env) <- "env_01"
env <- metaRangeEnvironment$new(sourceSDS = sim_env)
env$set_current(layer = 1)

Method print()

Prints information about the environment to the console

Usage
metaRangeEnvironment$print()
Returns

⁠<invisible self>⁠

Examples
env <- metaRangeEnvironment$new(
    sourceSDS = terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2, nlyr = 2))
)
env$print()

Examples


## ------------------------------------------------
## Method `metaRangeEnvironment$new`
## ------------------------------------------------

# Note: Only for illustration purposes.
env <- metaRangeEnvironment$new(sourceSDS = terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2)))
env

## ------------------------------------------------
## Method `metaRangeEnvironment$set_current`
## ------------------------------------------------

# Only for illustration purposes.
sim_env <- terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2, nlyr = 2))
names(sim_env) <- "env_01"
env <- metaRangeEnvironment$new(sourceSDS = sim_env)
env$set_current(layer = 1)

## ------------------------------------------------
## Method `metaRangeEnvironment$print`
## ------------------------------------------------

env <- metaRangeEnvironment$new(
    sourceSDS = terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2, nlyr = 2))
)
env$print()

[Package metaRange version 1.1.4 Index]