You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error and context
Hello,
I attempted to follow the tutorial to see if biomod2 could be used properly, but I kept running into issues with BIOMOD_EnsembleForecasting functions.
Code used to get the error
## setup environment ----
setwd('../workdir')
## install the latest release of biomod2
devtools::install_github('biomodhub/biomod2')
## load the required packages
library(biomod2)
library(ggplot2)
library(gridExtra)
library(raster)
library(rasterVis)
## read data ----
ProLau_occ <- read.csv('../data/ProLau_occ.csv')
summary(ProLau_occ)
bioclim_ZA_sub <-
raster::stack(
c(
bio_5 = '../data/worldclim_ZA/worldclim_ZA_bio_5.asc',
bio_7 = '../data/worldclim_ZA/worldclim_ZA_bio_7.asc',
bio_11 = '../data/worldclim_ZA/worldclim_ZA_bio_11.asc',
bio_19 = '../data/worldclim_ZA/worldclim_ZA_bio_19.asc'
)
)
bioclim_ZA_sub
## format the data ----
ProLau_data <-
BIOMOD_FormatingData(
resp.var = ProLau_occ['Protea.laurifolia'],
resp.xy = ProLau_occ[, c('long', 'lat')],
expl.var = bioclim_ZA_sub,
resp.name = "Protea.laurifolia",
PA.nb.rep = 2,
PA.nb.absences = 500,
PA.strategy = 'random'
)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-= Protea.laurifolia Data Formating -=-=-=-=-=-=-=-=-=-=-=-=-=-=
! No data has been set aside for modeling evaluation
! No data has been set aside for modeling evaluation
!!! Some data are located in the same raster cell.
Please set `filter.raster = TRUE` if you want an automatic filtering.
Checking Pseudo-absence selection arguments...
! No data has been set aside for modeling evaluation
> random pseudo absences selection
> Pseudo absences are selected in explanatory variables
! Some NAs have been automatically removed from your data
! No data has been set aside for modeling evaluation
!!! Some data are located in the same raster cell.
Please set `filter.raster = TRUE` if you want an automatic filtering.
! No data has been set aside for modeling evaluation
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ProLau_data
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.formated.data -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dir.name = .
sp.name = Protea.laurifolia
520 presences, 0 true absences and 932 undefined points in dataset
4 explanatory variables
bio_5 bio_7 bio_11 bio_19
Min. :212.0 Min. :136.0 Min. : 47.00 Min. : 0.0
1st Qu.:271.0 1st Qu.:237.0 1st Qu.: 96.75 1st Qu.: 23.0
Median :294.0 Median :266.5 Median :110.00 Median : 51.0
Mean :295.1 Mean :264.9 Mean :110.19 Mean :112.4
3rd Qu.:316.0 3rd Qu.:302.0 3rd Qu.:122.00 3rd Qu.:158.2
Max. :386.0 Max. :354.0 Max. :190.00 Max. :429.0
2 Pseudo Absences dataset available ( PA1, PA2 ) with 500 (PA1, PA2) pseudo absences
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## define individual models options ----
ProLau_opt <-
BIOMOD_ModelingOptions(
GLM = list(type = 'quadratic', interaction.level = 1),
GBM = list(n.trees = 1000),
GAM = list(algo = 'GAM_mgcv')
)
## run the individual models ----
ProLau_models <-
BIOMOD_Modeling(
bm.format = ProLau_data,
models = c("GLM", "GAM", "GBM"),
bm.options = ProLau_opt,
CV.strategy = "random",
CV.nb.rep = 2,
CV.perc = 0.8,
CV.do.full.models = TRUE,
metric.eval = c("KAPPA", "TSS", "ROC"),
var.import = 3,
do.progress = TRUE
)
show(ProLau_models)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.models.out -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Modeling folder : .
Species modeled : Protea.laurifolia
Modeling id : 1715090098
Considered variables : bio_5 bio_7 bio_11 bio_19
Computed Models : Protea.laurifolia_PA1_RUN1_GLM Protea.laurifolia_PA1_RUN1_GAM
Protea.laurifolia_PA1_RUN1_GBM Protea.laurifolia_PA1_RUN2_GLM
Protea.laurifolia_PA1_RUN2_GAM Protea.laurifolia_PA1_RUN2_GBM
Protea.laurifolia_PA1_allRun_GLM Protea.laurifolia_PA1_allRun_GAM
Protea.laurifolia_PA1_allRun_GBM Protea.laurifolia_PA2_RUN1_GLM
Protea.laurifolia_PA2_RUN1_GAM Protea.laurifolia_PA2_RUN1_GBM
Protea.laurifolia_PA2_RUN2_GLM Protea.laurifolia_PA2_RUN2_GAM
Protea.laurifolia_PA2_RUN2_GBM Protea.laurifolia_PA2_allRun_GLM
Protea.laurifolia_PA2_allRun_GAM Protea.laurifolia_PA2_allRun_GBM
Protea.laurifolia_allData_allRun_GLM Protea.laurifolia_allData_allRun_GAM
Protea.laurifolia_allData_allRun_GBM
Failed Models : none
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## run the ensemble models ----
ProLau_ensemble_models <-
BIOMOD_EnsembleModeling(
bm.mod = ProLau_models,
em.by = 'all',
metric.select = 'TSS',
metric.select.thresh = 0.8,
metric.eval = c('TSS','ROC'),
em.algo = c('EMmean','EMcv'),
var.import = 0
)
show(ProLau_ensemble_models)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.ensemble.models.out -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
sp.name : Protea.laurifolia
expl.var.names : bio_5 bio_7 bio_11 bio_19
models computed:
Protea.laurifolia_EMmeanByTSS_mergedData_mergedRun_mergedAlgo, Protea.laurifolia_EMcvByTSS_mergedData_mergedRun_mergedAlgo
models failed: none
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## do models projections ----
## current projections
ProLau_models_proj_current <-
BIOMOD_Projection(
bm.mod = ProLau_models,
new.env = bioclim_ZA_sub,
proj.name = "current",
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE
)
show(ProLau_models_proj_current)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= BIOMOD.projection.out -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Projection directory : ./Protea.laurifolia/current
sp.name : Protea.laurifolia
expl.var.names : bio_5 bio_7 bio_11 bio_19
modeling.id : 1715090098 ( ./Protea.laurifolia/Protea.laurifolia.1715090098.models.out )
models.projected :
Protea.laurifolia_PA1_RUN1_GLM, Protea.laurifolia_PA1_RUN1_GAM, Protea.laurifolia_PA1_RUN1_GBM, Protea.laurifolia_PA1_RUN2_GLM, Protea.laurifolia_PA1_RUN2_GAM, Protea.laurifolia_PA1_RUN2_GBM, Protea.laurifolia_PA1_allRun_GLM, Protea.laurifolia_PA1_allRun_GAM, Protea.laurifolia_PA1_allRun_GBM, Protea.laurifolia_PA2_RUN1_GLM, Protea.laurifolia_PA2_RUN1_GAM, Protea.laurifolia_PA2_RUN1_GBM, Protea.laurifolia_PA2_RUN2_GLM, Protea.laurifolia_PA2_RUN2_GAM, Protea.laurifolia_PA2_RUN2_GBM, Protea.laurifolia_PA2_allRun_GLM, Protea.laurifolia_PA2_allRun_GAM, Protea.laurifolia_PA2_allRun_GBM, Protea.laurifolia_allData_allRun_GLM, Protea.laurifolia_allData_allRun_GAM, Protea.laurifolia_allData_allRun_GBM
available binary projection : TSS
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ProLau_ensemble_models_proj_current <-
BIOMOD_EnsembleForecasting(
bm.em = ProLau_ensemble_models,
bm.proj = ProLau_models_proj_current,
metric.binary = "TSS",
output.format = ".img",
do.stack = FALSE
)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Ensemble Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Creating suitable Workdir...
Error in .fun_testIfIn(TRUE, "full.name", subset.list[["full.name"]], :
full.name must be 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value', 'value' or 'value
Environment Information
Please paste the output of sessionInfo() in your current R session below.
Thanks for reporting!
Your code seems correct. I suspect the error may come from the fact you don't have the latest version of the terra package.
Please note that you don't have the latest version of biomod2 either, but this new version will bring changes to your code for the options part.
You can find more information here.
Error and context
Hello,
I attempted to follow the tutorial to see if biomod2 could be used properly, but I kept running into issues with BIOMOD_EnsembleForecasting functions.
Code used to get the error
Environment Information
Please paste the output of
sessionInfo()
in your current R session below.Additional information
Thank in advance for your help.
Best regards.
The text was updated successfully, but these errors were encountered: