Three updates to speed up processing of environmental data:
apply 'class' on just the first row of covariate data instead of converting the whole spatRaster to a data.frame for getting class of covariate.
annotate all environmental data covariates for all species and datasets simultaneously, then split into nested dataset-species lists. This is repeated for annotating covariate data at mesh nodes. This replaces the nested for loops, which were responsible for the very slow data preparation.
use custom nearestValue function based on FNN package to annotate covariates using nearest non-NA cell. this is significantly faster than inlabru::bru_fill_missing().
Note: I have only tested with locations as class sf and spatial covariates as class SpatRaster. Some edits may be required for legacy formats (i.e., raster & sp).
Three updates to speed up processing of environmental data:
Note: I have only tested with locations as class sf and spatial covariates as class SpatRaster. Some edits may be required for legacy formats (i.e., raster & sp).