Create a spacemodel object
spacemodel.RdConstructor for the `spacemodel` class. This function combines spatial data (a raster stack) and ecological data (a trophic table) into a single object used for modelling.
Arguments
- raster_stack
A
SpatRasterobject (multi-layer stack) representing the spatial distribution of the species or groups.- trophic_tbl
An object of class
trophic_tblcontaining the ecological parameters and properties of the species.
Value
A SpatRaster object with the following additional attributes:
trophic_tbl: Thetrophic_tblobject passed as input.spacemodel: A logical flag set toTRUE, indicating this raster is part of a spacemodel.
Details
The function performs several checks to ensure data consistency:
Verifies that
raster_stackis aSpatRaster.Verifies that
trophic_tblis atrophic_tblobject.Ensures the number of raster layers matches the number of levels in the trophic table.
Ensures that the names of the raster layers match the names in the trophic table.
See also
rast, trophic_tbl