jcoliver / biodiversity-sdm-lesson

Introductory lesson to generate range maps for butterfly-host plant interactions and predict distributional shifts using publicly available biodiversity data and data science tools
MIT License
14 stars 5 forks source link

Some models are artificially bounded #4

Open jcoliver opened 6 years ago

jcoliver commented 6 years ago

Some funkiness is going on with models where one or more of the species' ranges are not realistic (i.e. portions of the range border is a long straight line). See scripts/examples/Papilio_cresphontes-future-sdm-pairwise.R and scripts/examples/Papilio_cresphontes-sdm-pairwise.R for an examples. Note western and eastern border for plant in: Papilio_cresphontes-pairwise-prediction.pdf

jcoliver commented 6 years ago

Likely caused by cropping the bioclim variables by the geographic extent of the observations. Bioclim data are tiled, so cropping might exclude tiles outside geographic extent of observations. Lines 76-88 of scripts/examples/Zanthoxylum_americanum-sdm-single.R:

# Determine geographic extent of our data
max.lat = ceiling(max(obs.data$lat))
min.lat = floor(min(obs.data$lat))
max.lon = ceiling(max(obs.data$lon))
min.lon = floor(min(obs.data$lon))
geographic.extent <- extent(x = c(min.lon, max.lon, min.lat, max.lat))

# Get the biolim data
bioclim.data <- getData(name = "worldclim",
                        var = "bio",
                        res = 2.5,
                        path = "data/")
bioclim.data <- crop(x = bioclim.data, y = geographic.extent)
jcoliver commented 6 years ago

Easiest quick fix is probably to just buffer the crop area by padding the geographic.extent used in the crop call.

jcoliver commented 6 years ago

Added some padding to extents, but the 10% default may not be enough. See scripts/examples/Papilio_cresphontes-future-sdm-single.R; the eastern boundary appears to still suffer from the arbitrary cutoff.