Code from: Climate, ecological dynamics, and the seasonal distribution of birds in mountains
Data files
Dec 26, 2025 version files 29.75 MB
-
01_mountain_ranges.R
6.31 KB
-
02_mountain_ranges_ebird.R
7.60 KB
-
03_mountain_slopes_delineation.R
135.12 KB
-
04_sample_completeness.R
10.57 KB
-
05_environmental_data.R
11.65 KB
-
06_empirical_patterns.R
14.72 KB
-
07_thermal_tracking.R
7.21 KB
-
08_simulated_patterns_and_analysis.R
80.66 KB
-
09_future_predictions.R
33.94 KB
-
10_eastern_himalayas.R
26.19 KB
-
mnt_slopes_data_new.RData
16.63 MB
-
mountain_ranges_2.dbf
5.41 KB
-
mountain_ranges_2.prj
145 B
-
mountain_ranges_2.shp
1.81 MB
-
mountain_ranges_2.shx
364 B
-
mountain_ranges.dbf
14.10 KB
-
mountain_ranges.prj
145 B
-
mountain_ranges.shp
1.87 MB
-
mountain_ranges.shx
796 B
-
mountain-key.csv
4.43 KB
-
ne_10m_geography_regions_polys.zip
4.59 MB
-
PresAbs_global.zip
4.49 MB
-
README.md
3.44 KB
Abstract
Biodiversity is unevenly distributed along elevational gradients. The predominant hypothesis is that macroevolutionary dynamics and climatic niche conservatism explain today’s elevational patterns of biodiversity, but the alternative energy efficiency hypothesis emphasizes modern ecological interactions related to energy budgets. We test these competing hypotheses by examining seasonal elevational ranges for 10,998 bird populations in 34 mountain regions. Multiple lines of evidence support the energy efficiency hypothesis, including that many mountain birds do not seasonally track their thermal niche with high fidelity, while simulation models based on optimal energy balancing under current environmental conditions yield predictions that tightly match empirical data. Our results reveal that altitudinal migration, which is widespread yet considerably understudied, is a behavioural mechanism fulfilling the same ecological function as long-distance latitudinal migration. Overall, this work provides a better understanding and predictive capacity for mountain birds under global change.
Dataset DOI: 10.5061/dryad.3j9kd51zq
Description of the data and file structure
This repository contains the scripts needed to run the analyses presented in Somveille M, Freeman BG, La Sorte FA & Tuanmu M. Mountains as ecological arenas: how climate and competition shape the seasonal distribution of birds along elevational gradients. Science Advances
Large datasets (ebird data, climate data) must be downloaded using the links provided in the manuscript.
The code files are numbered and ordered as follows:
- 01_mountain_ranges.R contains the code for initial processing of the mountain range data. This script uses the file mountain-key.csv, which contains the name and ID of all mountain ranges as well as the files in ne_10m_geography_regions_polys.zip which contains the mountain range polygons. It outputs a shapefile containing the mountain range polygons after initial processing (i.e., mountain_ranges.dbf, mountain_ranges.shp, mountain_ranges.prj, mountain_ranges.shx).
- 02_mountain_ranges_ebird.R contains the code for processing eBird data within each mountain range and filtering out mountain ranges with insufficient ebird data. It outputs a shapefile containing the mountain range polygons after this second filtering step (i.e, mountain_ranges_2.dbf, mountain_ranges_2.shp, mountain_ranges_2.prj, mountain_ranges_2.shx).
- 03_mountain_slopes_delineation.R contains the code for delineating mountain slopes
- 04_sample_completeness.R contains the code for filtering mountain ranges based on sampling completeness. This code outputs an RData file (mnt_slopes_data_new.RData) containing the final set of mountain slopes and the eBird data in each of the slopes used in the rest of the analysis. This RData file contains 4 objects:
- ebrd2_slopes: a data frame with all eBird observations across all mountain slopes included in the analysis, with each row corresponding to an observation and columns indicating the species name (scientificname), latitude, longitude, checklist ID (sampling_event_identifier), year, day, mountain range ID (mnt_ID), season, mountain slope name (slope) and elevation (in meters above sea level)
- mountain_ranges: a SpatVector object containing the polygons of the mountain ranges
- mountain_slope_polys: an sf object containing the polygons of the mountain slopes
- slopes_mountain_name: a vector indicating which mountain range each slope belongs to
- 05_environmental_data.R contains the code for extracting and processing environmental data
- 06_empirical_patterns.R contains the code for computing and plotting the empirical patterns
- 07_thermal_tracking.R contains the code for quantifying empirical seasonal thermal tracking
- 08_simulated_patterns_and_analysis.R contains the code for simulating and analysing the patterns based on energy efficiency. This file contains the code to calibrate the model, which uses empirical data on the global latitudinal patterns of bird migration (stored in PresAbs_global.zip)
- 09_future_predictions.R contains the code for predicting future patterns under climate warming
- 10_eastern_himalayas.R contains the code for predicting the Eastern Himalayas
Code/software
RStudio (Software capable of running R) is used for statistical analysis and data visualization.
