SpatialModel: R6 class representing a spatial model

SpatialModelR Documentation

R6 class representing a spatial model

Description

R6 class representing a generic (abstract) spatially-explicit model. It extends GenericModel with the addition of a study region specification.

Super classes

poems::GenericClass -> poems::GenericModel -> SpatialModel

Public fields

attached

A list of dynamically attached attributes (name-value pairs).

Active bindings

model_attributes

A vector of model attribute names.

region

A Region (or inherited class) object specifying the study region.

coordinates

Data frame (or matrix) of X-Y population (WGS84) coordinates in longitude (degrees West) and latitude (degrees North) (get and set), or distance-based coordinates dynamically returned by region raster (get only).

attribute_aliases

A list of alternative alias names for model attributes (form: alias = "attribute") to be used with the set and get attributes methods.

error_messages

A vector of error messages encountered when setting model attributes.

warning_messages

A vector of warning messages encountered when setting model attributes.

Methods

Public methods

Inherited methods

Method new()

Initialization method sets given attributes individually and/or from a list.

Usage
SpatialModel$new(region = NULL, ...)
Arguments
region

A Region (or inherited class) object specifying the study region.

...

Parameters passed individually.


Method new_clone()

Creates a new (re-initialized) object of the current (inherited) object class with optionally passed parameters.

Usage
SpatialModel$new_clone(...)
Arguments
...

Parameters passed via the inherited class constructor (defined in initialize and run via new).

Returns

New object of the current (inherited) class.


Method clone()

The objects of this class are cloneable with this method.

Usage
SpatialModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# U Island example region
coordinates <- data.frame(x = rep(seq(177.01, 177.05, 0.01), 5),
                          y = rep(seq(-18.01, -18.05, -0.01), each = 5))
template_raster <- Region$new(coordinates = coordinates)$region_raster # full extent
template_raster[][-c(7, 9, 12, 14, 17:19)] <- NA # make U Island
region <- Region$new(template_raster = template_raster)
# Example spatial model
model1 <- SpatialModel$new(region = region, a_layers = 3)
model1$coordinates
model1$set_attributes(a_values = array(8:28, c(7, 3)))
model1$region$raster_from_values(model1$get_attribute("a_values"))


poems documentation built on Oct. 7, 2023, 9:06 a.m.