Create a SpatRaster of SVEIRD model compartment raster data
Source:R/SVEIRD.BayesianDataAssimilation.R
getSVEIRD.SpatRaster.Rd
Create a SpatRaster objects, with a layer for each component in an SVEIRD epidemic model.
Arguments
- subregions
a SpatVector object of subregions used to crop the population SpatRaster before creating the other layers in the raster object to represent the other compartments in a SVEIRD epidemic model. If it is missing no cropping is performed.
- population
a SpatRaster of population count data; it must be pre-aggregated if any aggregation is to be used during the simulation; none is performed by this function or downstream functions in the overall implementation of SVEIRD.BayesianDataAssimilation simulations.
- aggregationFactor
the number of cells in any direction to aggregate together into one, in the input raster, after masking with the subregions vector.
Details
The SpatRaster objects for the VEIRD components are empty, the input SpatRaster is taken as the Suscptible layer, the only layer with non-zero values (if any existed before).
Examples
subregionsSpatVector <- terra::vect(
system.file(
"extdata",
## COD: Nord-Kivu and Ituri (Democratic Republic of Congo)
"subregionsSpatVector",
package = "spatialEpisim.foundation",
mustWork = TRUE
)
)
susceptibleSpatRaster <- terra::rast(
system.file(
"extdata",
"susceptibleSpatRaster.tif", # Congo population
package = "spatialEpisim.foundation",
mustWork = TRUE
)
)
getSVEIRD.SpatRaster(subregionsSpatVector, susceptibleSpatRaster,
aggregationFactor = 10)
#> class : SpatRaster
#> dimensions : 69, 49, 6 (nrow, ncol, nlyr)
#> resolution : 0.08333333, 0.08333333 (x, y)
#> extent : 27.22375, 31.30708, -2.075416, 3.674584 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> source(s) : memory
#> names : Susceptible, Vaccinated, Exposed, Infected, Recovered, Dead
#> min values : 0, 0, 0, 0, 0, 0
#> max values : 739582, 0, 0, 0, 0, 0
## Omitting the aggregation factor argument will prevent aggregation. An
## aggregation factor of zero or one is meaningless and will produce an
## error.
getSVEIRD.SpatRaster(subregionsSpatVector, susceptibleSpatRaster)
#> class : SpatRaster
#> dimensions : 689, 487, 6 (nrow, ncol, nlyr)
#> resolution : 0.008333333, 0.008333333 (x, y)
#> extent : 27.22375, 31.28208, -2.067083, 3.674584 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> source(s) : memory
#> varnames : susceptibleSpatRaster
#> susceptibleSpatRaster
#> names : Susceptible, Vaccinated, Exposed, Infected, Recovered, Dead
#> min values : 0.00, 0, 0, 0, 0, 0
#> max values : 32905.59, 0, 0, 0, 0, 0
## Omitting a SpatVector will return a SpatRaster with layers representing each
## of SVEIRD without cropping or masking the input SpatRaster in any way.
getSVEIRD.SpatRaster(subregionsSpatVector, susceptibleSpatRaster)
#> class : SpatRaster
#> dimensions : 689, 487, 6 (nrow, ncol, nlyr)
#> resolution : 0.008333333, 0.008333333 (x, y)
#> extent : 27.22375, 31.28208, -2.067083, 3.674584 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> source(s) : memory
#> varnames : susceptibleSpatRaster
#> susceptibleSpatRaster
#> names : Susceptible, Vaccinated, Exposed, Infected, Recovered, Dead
#> min values : 0.00, 0, 0, 0, 0, 0
#> max values : 32905.59, 0, 0, 0, 0, 0