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

Issue with the ensemble() function export #4

Closed komazsofi closed 3 years ago

komazsofi commented 3 years ago

Hi Babak,

I am writing because currently I am using the sdm package to do ensemble species distribution modelling, however I am not able to retrieve the ensemble predicted files from the ensemble() function.

My code is the following:

data_forsdm <- sdmData(formula=occurrence~., train=birds[,-c(1,2)], predictors=lidar_crop)

model <- sdm(occurrence~.,data=data_forsdm,methods=c('brt','rf','maxent'),replication=c('cv','boot'),cv.folds=5,n=10)
#write.sdm(model,'ensemble_GRW_LiDAR_NL_cv10_boot_n50')

p1 <- ensemble(model, newdata=lidar_crop, filename='',setting=list(method='weighted',stat='AUC'))

The error message after running the last line:

Error in o[[id[j]]] : subscript out of bounds

And then I did not get the p1 object file back and no automatic file export happens.

I would like to ask whether it is possible to help me to fix this issue? Do you need my files to reproduce the issue?

Thank you in advance for your help!

Best, Zsófia

Abdelmutalab commented 2 years ago

Hi Zsófia, Did you manage to solve the issue? I am facing the same problem

guilhermechicarolli commented 2 years ago

Hello, I found thesame problem, the same code works for another specie but not for a specific one. Did you resolve it? Regards

Abdelmutalab commented 2 years ago

Yes, I have solved it. I found one of my coordinates projected on the ocean where there there is no data, I removed that point from my dataset and then run the model.