Convert a BAM simulation object to RasterStack.
Arguments
- sdm_simul
A bam object. See
sdm_sim
- which_steps
A numeric vector indicating the simulation steps that are going to be converted into raster layers.
Examples
# \donttest{
model_path <- system.file("extdata/Lepus_californicus_cont.tif",
package = "bamm")
model <- raster::raster(model_path)
sparse_mod <- bamm::model2sparse(model,threshold=0.1)
adj_mod <- bamm::adj_mat(sparse_mod,ngbs = 1)
occs_lep_cal <- data.frame(longitude = c(-115.10417,
-104.90417),
latitude = c(29.61846,
29.81846))
occs_sparse <- bamm::occs2sparse(modelsparse = sparse_mod,
occs = occs_lep_cal)
sdm_lep_cal <- bamm::sdm_sim(set_A = sparse_mod,
set_M = adj_mod,
initial_points = occs_sparse,
nsteps = 10)
#>
|
| | 0%
|
|====== | 9%
|
|============= | 18%
|
|=================== | 27%
|
|========================= | 36%
|
|================================ | 45%
|
|====================================== | 55%
|
|============================================= | 64%
|
|=================================================== | 73%
|
|========================================================= | 82%
|
|================================================================ | 91%
|
|======================================================================| 100%
sdm_lep_cal_st <- bamm::sim2Raster(sdm_simul = sdm_lep_cal,
which_steps = seq(1,10,by=1))
raster::plot(sdm_lep_cal_st)
# }