babaknaimi / sdm

sdm is an extensible framework to develop species distributions models using individual and community-based approaches, generate ensembles of models, evaluate the models, and predict species potential distributions in space and time.
21 stars 5 forks source link

Error in the sdm::ensemble() function in GNU/Linux Ubuntu #27

Open mauriciovancine opened 4 months ago

mauriciovancine commented 4 months ago

Dear,

I'm trying without success to find the error in the ensemble() function in GNU/Linux Ubuntu.

Could you indicate a way to find the error?

Thanks!

Running the function example:

# library
library(sdm)

# data
file <- system.file("external/species.shp", package="sdm") # get the location of the species data
species <- vect(file) # read the shapefile
path <- system.file("external", package="sdm") # path to the folder contains the data
lst <- list.files(path=path,pattern='asc$',full.names = T) # list the name of the raster files

# stack is a function in the raster package, to read/create a multi-layers raster dataset
preds <- rast(lst) # making a raster object

d <- sdmData(formula=Occurrence~., train=species, predictors=preds)
d

# fit the models (5 methods, and 10 replications using bootstrapping procedure):
m <- sdm(Occurrence~.,data=d,methods=c('rf','tree','fda','mars','svm'),
 replicatin='boot',n=10)

# ensemble using weighted averaging based on AUC statistic:
p1 <- ensemble(m, newdata=preds, filename='ens.tif',setting=list(method='weighted',stat='AUC'))

Error in .canProcessInMemory(.out[[1]], max(nlyr(.out), nlyr(newdata)) * :
 in the slot of name "cpp" for this object of class "SpatRaster"