Pinus nigra (Black Pine) is a widely distributed species in the Mediterranean region. Understanding the potential impacts of climate change on its habitat suitability is crucial for conservation efforts. In this study, it is aimed to model the future distribution of Pinus nigra under climate change scenarios by using species occurrence data and bioclimatic variables. We use historical and future climate data to predict the species’ potential distribution under current and future climate conditions.
The occurrence data for Pinus nigra was obtained from the Global Biodiversity Information Facility (GBIF). The data was loaded into a data frame, and a subset of the data containing only the coordinates was created. To manage large datasets, we reduced the size of the dataset by randomly selecting non-repeating occurrence points using the dplyr package in R.
# Set the working directory to where your data is stored
setwd("/Users/silapakyuz/Desktop/Term_Project/sila_pakyuz_proje")
# Load and clean species occurrence data
Pinus_nigra_gbif <- read_delim("~/Desktop/Term_Project/Pinus_nigra_gbif.csv", delim = "\t", trim_ws = TRUE)
## Rows: 76 Columns: 50
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (26): datasetKey, occurrenceID, kingdom, phylum, class, order, family, ...
## dbl (10): gbifID, decimalLatitude, decimalLongitude, coordinateUncertaintyI...
## lgl (11): verbatimScientificNameAuthorship, locality, individualCount, coor...
## dttm (3): eventDate, dateIdentified, lastInterpreted
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Pinus_nigra_XY <- Pinus_nigra_gbif[, c("decimalLongitude", "decimalLatitude")]
Pinus_nigra_sampled <- slice_sample(Pinus_nigra_XY, n = 3000, replace = FALSE)
Pinus_nigra_clean <- Pinus_nigra_sampled %>% filter(!is.na(decimalLongitude) & !is.na(decimalLatitude))
write_csv(Pinus_nigra_clean, "~/Desktop/Term_Project/Pinus_nigra_clean.csv")
# Convert to spatial format
Pinus_sf <- st_as_sf(Pinus_nigra_clean, coords = c("decimalLongitude", "decimalLatitude"), crs = 4326)
# Visualize occurrence points
ggplot() +
geom_sf(data = Pinus_sf, color = "blue", size = 1) +
theme_minimal() +
labs(title = "Pinus Nigra Occurrence Points", x = "Longitude", y = "Latitude")
The historical bioclimatic variables were obtained from the WorldClim database with a spatial resolution of 5 arc-minutes. The variables used in the study are: BIO1: Annual Mean Temperature BIO2: Mean Diurnal Range BIO12: Annual Precipitation These variables were available as raster files (historical_climate_bio1.tif, historical_climate_bio2.tif, historical_climate_bio12.tif) located in the project directory.
# Dosya yollarını doğru şekilde belirt
bio1 <- raster("/Users/silapakyuz/Desktop/Term_Project/historical_climate_bio1.tif")
bio2 <- raster("/Users/silapakyuz/Desktop/Term_Project/historical_climate_bio2.tif")
bio12 <- raster("/Users/silapakyuz/Desktop/Term_Project/historical_climate_bio12.tif")
plot(bio1, main="Bio1 - Annual Mean Temperature")
plot(bio2, main="Bio2 - Mean Diurnal Range")
plot(bio12, main="Bio12 - Annual Precipitation")
Future bioclimatic data was obtained from the WorldClim database for the 2021-2040 period, with a spatial resolution of 5 arc-minutes. The climate projections were based on the SSP585 scenario from the MIROC6 model. This data was available as the future_climate.tif raster file. Future bioclimatic data (2021-2040, SSP585, MIROC6) was processed similarly.
future_bio_stack <- stack("~/Desktop/Term_Project/future_climate.tif")
# Select relevant layers
future_bio_stack_selected <- future_bio_stack[[c("bio01", "bio02", "bio12")]]
The species occurrence data was formatted for SDM using the sp package in R. The coordinates of the occurrence points were converted into spatial points using the SpatialPoints function. The chosen bioclimatic variables (BIO1, BIO2, and BIO12) were loaded using the raster package, and these variables were stacked using the stack function to create the bioclimatic layers.
bio_stack <- stack(bio1, bio2, bio12)
coordinates(Pinus_nigra_clean) <- ~decimalLongitude + decimalLatitude
crs(Pinus_nigra_clean) <- CRS("+proj=longlat +datum=WGS84")
Both the Generalized Additive Model (GAM) and MaxEnt models were used to predict the species’ distribution based on the occurrence data and bioclimatic variables. Since MaxEnt models work best with only presence data, it was chosen for modeling the presence-only data, while GAM was used to model both presence and pseudo-absence data. The data was split, with 80% used for model calibration and 20% for model evaluation.
# Convert 'Pinus_nigra_clean' from SpatialPoints to a data frame
species_data <- data.frame(
long = coordinates(Pinus_nigra_clean)[,1], # Extract longitude (first column)
lat = coordinates(Pinus_nigra_clean)[,2] # Extract latitude (second column)
)
# Check that the conversion worked
head(species_data)
## long lat
## 1 32.00601 40.36505
## 2 32.78901 39.86263
## 3 26.30578 39.64920
## 4 32.84141 39.82983
## 5 30.41516 39.08800
## 6 32.50514 40.47481
if (!exists("species_data") || !all(c("long", "lat") %in% colnames(species_data))) {
stop("The 'species_data' object is not properly defined or is missing required columns.")
}
The historical climate data (BIO1, BIO2, and BIO12) was used to project both the GAM and MaxEnt models. These projections represent the current potential distribution of Pinus nigra under historical climate conditions.
# Debugging and Running MaxEnt Model
if (!exists("bio_stack") || !inherits(bio_stack, "RasterStack")) {
stop("The 'bio_stack' object is not properly defined or is not a RasterStack.")
}
# Convert 'Pinus_nigra_clean' from SpatialPoints to a data frame
species_data <- data.frame(
long = coordinates(Pinus_nigra_clean)[,1], # Extract longitude (first column)
lat = coordinates(Pinus_nigra_clean)[,2] # Extract latitude (second column)
)
# Check that 'species_data' is properly defined
if (!exists("species_data") || !all(c("long", "lat") %in% colnames(species_data))) {
stop("The 'species_data' object is not properly defined or is missing required columns.")
}
# Run MaxEnt Model
maxent_model <- maxent(bio_stack, species_data)
# Check the model object
if (!inherits(maxent_model, "MaxEnt")) {
stop("The MaxEnt model was not created successfully.")
}
# Predict Habitat Suitability
maxent_prediction <- tryCatch(
predict(maxent_model, bio_stack),
error = function(e) {
stop("Error during prediction: ", e$message)
}
)
# Plot Prediction
if (!is.null(maxent_prediction)) {
plot(maxent_prediction, main = "Pinus Nigra Historical Habitat Suitability")
} else {
stop("Prediction failed. Check the model and input data.")
}
# Performans Değerlendirmesi: ROC ve AUC
install.packages("ROCR")
##
## The downloaded binary packages are in
## /var/folders/9q/dtkwm1894fjg69l75kgrtppc0000gn/T//Rtmp4FNBEj/downloaded_packages
library(ROCR)
names(bio_stack)
## [1] "historical_climate_bio1" "historical_climate_bio2"
## [3] "historical_climate_bio12"
# Katman isimlerini değiştirme
names(bio_stack) <- c("bio1", "bio2", "bio12")
In order to controll MaxEnt model performance Area Under Curve have been checked and found that higher than 0.7 which is good for this model.
For the future projections, the 2021-2040 climate data for the SSP585 scenario was used. The future bioclimatic variables (BIO1, BIO2, and BIO12) were stacked into a raster object using the raster::stack function, and the models were projected onto this future climate data.
future_climate <- stack("/Users/silapakyuz/Desktop/Term_Project/future_climate.tif")
names(future_climate)
## [1] "bio01" "bio02" "bio03" "bio04" "bio05" "bio06" "bio07" "bio08" "bio09"
## [10] "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16" "bio17" "bio18"
## [19] "bio19"
future_climate_subset <- future_climate[[c("bio01", "bio02", "bio12")]]
names(future_climate_subset) <- c("bio1f", "bio2f", "bio12f")
future_climate_subset <- stack(future_climate_subset)
names(future_climate_subset)
## [1] "bio1f" "bio2f" "bio12f"
names(future_climate_subset) <- c("bio1f", "bio2f", "bio12f")
names(future_climate_subset)
## [1] "bio1f" "bio2f" "bio12f"
class(future_climate_subset)
## [1] "RasterStack"
## attr(,"package")
## [1] "raster"
maxent_model_future <- maxent(future_climate_subset, species_data)
future_prediction <- predict(maxent_model_future, future_climate_subset)
plot(future_prediction, main = "Pinus Nigra Future Habitat Suitability",
xlab = "Longitude", ylab = "Latitude")
plot(future_prediction, main = "Pinus Nigra Future Habitat Suitability",
col = terrain.colors(100), xlab = "Longitude", ylab = "Latitude")
The potential habitat suitability of Pinus nigra under historical and future climatic conditions reveals important insights into the species’ resilience to environmental change. The models indicate that the species’ core habitat range, predominantly located in the Mediterranean, Central Europe, and parts of Western Asia, remains stable across both scenarios. This stability suggests that Pinus nigra is likely to retain much of its ecological niche despite the challenges posed by climate change.
In the historical suitability map, high-suitability zones are concentrated within the Mediterranean basin and extend into adjacent temperate regions. This aligns with the species’ known adaptability to Mediterranean climates characterized by hot, dry summers and mild, wet winters. The future projections, while largely consistent with the historical distribution, highlight subtle shifts in habitat suitability. Specifically, certain areas exhibit a slight reduction in suitability, particularly along marginal zones, while others, notably at higher latitudes, show potential for expansion. These observations suggest a tendency for Pinus nigra to track favorable climatic conditions, potentially extending its range northward under warming scenarios.
The observed shifts are relatively modest, which underscores the species’ ability to persist under projected climatic changes. This adaptability may be attributed to the species’ ecological plasticity, allowing it to thrive across a range of climatic and soil conditions. However, the slight reductions in suitability in some areas raise concerns about the impacts of localized stressors, such as increased drought frequency and intensity, which could exacerbate habitat fragmentation or limit regeneration success.
From a conservation perspective, these findings emphasize the importance of protecting Pinus nigra’s current strongholds, particularly in regions with consistently high suitability. Additionally, proactive management strategies should focus on facilitating the species’ potential range expansion into newly suitable areas. This may involve assisted migration or the establishment of buffer zones to ensure connectivity between populations.
It is important to acknowledge the limitations of the modeling approach. The projections are based solely on bioclimatic variables and do not account for other critical factors such as soil properties, competition, and human-induced land use changes. Furthermore, the inherent uncertainties in future climate scenarios may influence the accuracy of the results. Future studies could benefit from incorporating additional ecological parameters and exploring more nuanced climate projections to refine habitat suitability predictions.
In conclusion, while Pinus nigra demonstrates significant resilience to climate change, its long-term survival will depend on effective conservation measures and adaptive forest management. The findings of this study provide a foundation for understanding the potential impacts of climate change on the species and can inform strategies to safeguard its ecological and economic roles in forest ecosystems.
I first learnt how to locate a species’ occurrence. I utilized GBIF to do this. After that, I discovered how to use this data to create an ecological niche model. We may utilize a variety of factors to do this. One such parameter that may be employed is bioclimatic parameters. I was able to collect both current and future parameters from the WorldClim database. I then performed an ecological niche model for the present and future with various SSPs using the biomod2 package of R. In the meanwhile, I gained knowledge about how the biomod2 functions—like formatting, modeling, and data projection—operate. Ultimately, this assignment taught me how to use R Markdown, even though I had previously dealt with R.
`