Skip to content

Comments

39 implement changes of diederik#41

Merged
soriadelva merged 369 commits intomasterfrom
39-implement-changes-of-diederik
Feb 20, 2026
Merged

39 implement changes of diederik#41
soriadelva merged 369 commits intomasterfrom
39-implement-changes-of-diederik

Conversation

@soriadelva
Copy link
Collaborator

@soriadelva soriadelva commented Sep 9, 2025

This PR contains the complete reworking of the wiSDM modelling flow, containing changes in the pseudoabsence selection, model fitting, input layers, ensemble model creation, and validation. These are all explained in the ReadME.

To test the code: run script 06_run_wiSDM. The workflow configurations can be specified in script 00, this is the only script in which users have to specify things manually, other scripts should be run without user input.

Implemented changes:

  • Pseudoabsence selection:
    ** Global model: Pseudoabsences are sampled within the same biomes as species presences but excluded from presence grid cells. A taxonomic occurrence grid (bias grid) captures the sampling intensity of the higher taxon and is used to weight grid cells, assigning greater weight to well-sampled areas.
    ** European model: Pseudoabsences are sampled across all of Europe, excluding presence grid cells. In ecoregions with presences, grid cells are weighted using the bias grid, while outside these ecoregions all cells are assigned the minimum weight (1).

  • Model fitting:
    Models are fitted using the sdm package. In total, 10 different modelling frameworks are fitted on the data ("glm", "gam", "bioclim", "brt", "rf", "glmpoly", "mars", "maxent", "fda", and "cart"). A PCA of model predictions is created, and the 5 models that explain most of the variance along the PC1 axes are selected to create an ensemble with based on the median value of the five models.

  • Model creation:
    The global model is created based on the CHELSA v2 climatic layers, aggregated to a resolution of 5km (using the average). A habitat model is then created at the European level. Global model (climatic suitability predictions) are converted to a 1km resolution and the final predictions are created by combining the climatic predictions with the habitat predictions (multiplying them and taking the sqrt of these values).

  • Occurrences records:
    Occurrences are downloaded from GBIF and processed to remove duplicates, occurrences that fall in grid cells with NA predictor values, occurrences close to country and capital centroids, biodiversity institutes, GBIF headquarters, and the 0,0 point. For the global model, occurrences with a maximum coordinate uncertainty up to 5km (i.e., the resolution of the layers) are kept, while for the European habitat model, only occurrences with a coordinate uncertainty up to 1km are kept (i.e., the resolution of the habitat layers).

  • Predictor layers:
    We now use CHELSA v2 climatic layers (previously, v1 was used). These layers were rescaled to minimize issues arising from differences in units and resulting orders of magnitude.
    Habitat layers were updated to incorporate new water-related layers, and the CORINE layers have also been regenerated using the latest corine land use raster available on Copernicus.

soriadelva and others added 30 commits September 3, 2025 10:21
folder created
script for bias layers added
just created a file to start
@soriadelva
Copy link
Collaborator Author

@SanderDevisscher, bekijk je deze nog eens?

@SanderDevisscher
Copy link
Collaborator

Just was eraan begonnen maar ben nog op een issue gestoten. Ik weet alleen niet meer wat 🤦

@SanderDevisscher
Copy link
Collaborator

@soriadelva the error remains:

[1] "[FUTURE] Projecting: 2041-2070 ssp126"
Spherical geometry (s2) switched off
although coordinates are longitude/latitude, st_intersects assumes that they are planar
Spherical geometry (s2) switched on
Predictions successfully completed for method 'glm'.
Predictions successfully completed for method 'gam'.
Predictions successfully completed for method 'bioclim'.
Predictions successfully completed for method 'brt'.
Predictions successfully completed for method 'rf'.
Predictions successfully completed for method 'glmpoly'.
Predictions successfully completed for method 'mars'.
Predictions successfully completed for method 'maxent'.
Predictions successfully completed for method 'fda'.
Predictions successfully completed for method 'cart'.
  |============================================================                                                            |  50%
Progress interrupted by simpleError condition: [writeRaster] cannot write file
Error: [writeRaster] cannot write file

@SanderDevisscher
Copy link
Collaborator

@soriadelva here's my sessioninfo

@soriadelva soriadelva merged commit 768d6c1 into master Feb 20, 2026
@soriadelva soriadelva deleted the 39-implement-changes-of-diederik branch February 20, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Implement changes of Diederik

3 participants