-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I have sucessfully updated and run the blockcv with biomod 2 vignette. However when I try to adapt the code for my custom data I run into a seemingly unclear error.
I have made sure that the input species data is an sf object that matches the data types of that used in the vignette. I have made sure there are no na values and made sure that the coordinates have valid values between -180 and 180. I have also plotted the raster and points data and they both overlap.
Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, :
Loop 0 is not valid: Edge 1 crosses edge 4
In addition: Warning message:
In st_is_longlat(x) :
bounding box has potentially an invalid value range for longlat data
code that is been run
pa_data <- sf::st_as_sf(cereus_data, coords = c("x", "y"), crs = st_crs(predictor_stack))
3. Generate background/pseudo-absence points ----
set.seed(1)
spp_all <- sample_pseudoabs(data = pa_data,
raster = predictor_stack,
n = 1 * nrow(pa_data),
method = c('dist_min', 10000),
class_label = "pseudoabs",
return_pres = TRUE)
spp_all <- na.omit(spp_all)
spp_all$class<- as.factor(spp_all$class)
Run spatial cross-validation
scv1 <- cv_spatial(
x = spp_all,
column = 'class', # Response column name
r = predictor_stack,
k = 5,
selection = 'systematic', plot = T, seed = 1, rows_cols = c(160)
)