## ############################################################################
##
## The 2024 Lancet Countdown in Europe report
## Indicator 1.3.6: Climatic Suitability for Ticks
##
## Script 02: Explore tick presence by land cover class
## 
## Authors: 
## - Martín Lotto Batista, ORCID: 0000-0002-9437-5270
## - Prof. Rachel Lowe, ORCID: 0000-0003-3939-7343
##
## Contact: martin.lotto@bsc.es
## 
## ############################################################################library(tidyverse)

# Packages
pacman::p_load(sf, raster)

# Maps
ticks <- st_read("data/data_in/ixodes_ricinus/ixodes_location.shp", quiet=TRUE)
mp <- st_read("data/data_in/maps/EEA_38.shp", quiet=TRUE)
env <- raster("data/data_in/land_use/U2018_CLC2018_V2020_20u1_4326.tif")

plot(ticks$geometry, col="blue"); maps::map("world", add=T)

# Extract values that overlap with observations of Ixodes ricinus
t <- extract(env, ticks)

# Extract summary statistics
table(t)
sort(desc((table(t)/length(t))*100))

# 82.4% of the Ixodes ricinus observations were in
# - Discontinuous urban fabric (9.4%)
# - Non-irrigated croplands (10.5%)
# - Broad-leaf and coniferous forests (33.5%)
# - Moors and heathlands (29%)

# END