This repository has all scripts necessary to run create the species distribution models (SDM) for the bee species.
After cloning this repository on your computer, open the project in RStudio.
This will trigger the automatic installation of all dependencies. If the
installation of dependencies does not occur automatically, you need to
first install the renv
package and then execute: renv::restore()
.
On config.yml
file most of the modelling parameters are set. Change them as
needed, but default values are the current used.
The preprocessing.R
file takes an occurrence file for a given species and
performs duplicate record removal. In this context, a duplicate record implies
that the occurrence is within a distance equal to or less than the configured
resolution parameter. The script also creates an Area of Interest (AOI) for
modelling. The AOI is generated by selecting Terrestrial Ecoregions with at
least one species presence. After executing the script, the AOI region and
de-duplicated occurrence files are created. Open a terminal window to execute
the script as follows:
$ Rscript preprocessing.R {occurrence_file.csv}
Tip
Naming the occurrence file with a species code is suggested to ensure clear information in the output files.
The fit_model.R
script receives as argument the folder where the AOI and
de-duplicated occurrence files were saved. The script will do the modelling
based on the parameters in config.yml
file, this include which covariates will
be considered. As and output of the scripts the following products will be
available:
- A
Maxent_models.Rds
files were the MaxEnt fitted models were saved. enmeval_results.csv
file withe some model evaluation statistics.- Raster files with name
ENM_prediction_M_raw_*.tif
which correspond to the models with minimal AIC. - Binary raster files under
binary_output
folder for different cutting levels based on minimal suitability, or 5% or 10% percentiles as threshold suitability.
All the generated data should be reviewed to verify that the results are plausible.
Finally, the future_proj.R
script, can be called using the same folder where
all the fitted results were stored
$ Rscript future_proj.R output/{sp_code}
to generate a future climate conditions model. As output raster files with future projected model will be generated.
Important
All model outputs should be manually inspected for consistency.
The project utilizes the following datasets:
-
WWF Terrestrial Ecoregions of the World: Terrestrial Ecoregions of the World is a biogeographic regionalization of the Earth's terrestrial biodiversity.
-
WorldClim version 2.1: WorldClim is a database of high spatial resolution global weather and climate data.
-
ECOAB - Bee occurrences dataset: Curated bee occurrences dataset.
The author of this scripts and analysis are (in alphabetical order):
- Juan M Barrios [email protected]
- Carlos Cultid [email protected]
- Oscar Martínez [email protected]
- Remy Vandame [email protected]
Some parts of the code was take from
ModelosDarwinUICN written by
Juan M. Barrios [email protected] and
Angela P. Cuervo-Robayo [email protected].