DOI: 10.5281/zenodo.17513831
title: Code and data for paper "Scale dependence of avian functional rarity reveals mismatches between global and local conservation priorities"

description: 1) What’s inside





FREE_BIRD.Rproj – open this to work within the project root in RStudio.




analysis/ – step-by-step analysis scripts:





A_prepare_data_and_compute_rarities.R




B_Vizualize_species_metrics.R




C_map_multiscale-prioritisation.R






R/ – helper functions used by the analysis (e.g., function_compute_pool_distinctiveness.R, function_diversity_optimisation.R, find_neighbors.R, plotting/transformation utilities).




data/SpatialData/ – spatial layers and precomputed helper tables (global grid, land/ocean/coastline shapes, ecoregions, protected area coverage, neighbor lists, etc.). Several are large (hundreds of MB to a few GB). Examples:





AllSpeciesBirdLifeMaps2019.csv




neighbor tables (e.g., cell_neighbors_within_30k.csv, cell_neighbors_within_distance.csv)




Natural Earth and other shape files (ne_110m_*, ne_50m_coastline, world_ecoregions, Behrmann meter grids), each with their own small READMEs/VERSION notes.






data/TraitData/ – AVONET tables (AVONET_Raw_Data.csv, species list, sources, duplicates, etc.).




figures_tables/ – rendered figures and tables used in the paper; includes the folder supp_FigureWithoutSEAbirds/ with sensitivity figures that exclude seabirds.




outputs/ – created when you run the scripts; contains intermediate objects and exported rasters/maps (will be populated by the analysis).





The archived deposit is released under CC-BY-4.0; please credit the authors when reusing code or derived data.


2) Requirements





R (RStudio recommended). The project is R-based.




Disk & RAM. Several inputs are multi-GB (e.g., neighbor tables); ensure ample disk space (tens of GB) and sufficient memory for large table joins and raster operations.




Packages. The scripts will load typical spatial/data packages (e.g., data.table/readr, sf, terra/raster, dplyr, ggplot2, etc.). If any package is missing, install on first run.



3) Quick start





Download & unzip FREE_BIRD_repo.zip.




Open FREE_BIRD.Rproj in RStudio (your working directory will be the project root).




Run the scripts in order (A → B → C) from the analysis/ folder:





A_prepare_data_and_compute_rarities.R





Reads AVONET traits (data/TraitData/) and species distributions / spatial scaffolding (data/SpatialData/).




Computes functional distinctiveness/restrictiveness and composite rarity across the defined spatial grains; writes cleaned/derived objects to outputs/. 






B_Vizualize_species_metrics.R





Produces species-level summaries/diagnostics and figures (e.g., PCA of distinctiveness axes, scale comparisons); saves figures into figures_tables/ and intermediate summaries into outputs/.






C_map_multiscale-prioritisation.R





Generates gridded maps of richness/rarity/prioritization at multiple scales and writes GeoTIFF/PNG outputs to outputs/ and figures_tables/.









Tip: run each script from the project root so relative paths (e.g., data/SpatialData/...) resolve correctly.


4) Inputs you should know about





Species distributions: AllSpeciesBirdLifeMaps2019.csv (BirdLife consolidated presence by grid cell).




Spatial scaffolding: Behrmann meter grid shapefiles (reference_grid/, worldBehrmannMetergrid_WGS84/), land/ocean/coastline layers (ne_110m_*, ne_50m_coastline), ecoregions, hotspots; each subfolder ships its own small README/VERSION or metadata file.




Trait data: AVONET CSVs under data/TraitData/. 




Neighbor tables: large CSVs used to compute within-distance neighborhood metrics (e.g., 30 km, 300 km). Expect long read times. 



5) Expected outputs





Recreated figures and tables will appear under figures_tables/ (e.g., global maps, PCA plots; the repository already includes a set of rendered figures, including those without seabirds for sensitivity). 




Intermediate data products and final rasters/CSV summaries will be written under outputs/ by scripts B and C. (Folder created on first run.) 



6) Reproducing the paper figures





After running A and B, you should recover the species-level plots (PCA, rarity components).




After C, you should recover the multiscale global maps used in the main text and supplement; check figures_tables/ against the provided supp_FigureWithoutSEAbirds/ examples to verify consistency. 



7) Notes, licensing, and attribution





The Zenodo record is Version 1 (published 3 Nov 2025) and is licensed CC-BY-4.0; cite the deposit DOI in any reuse. 




Some third-party layers in data/SpatialData/ include their own README/VERSION files; please respect their original terms when redistributing derived products.