DOI: 10.5281/zenodo.17834326
title: Moonlight: a neglected driver of primate sleep ecology

description: README


Moonlight: a neglected driver of primate sleep ecology

(Zenodo deposit)

This dataset and code accompany the Ecology Letters manuscript. They document how we built used versus available sleeping-site datasets, generated multiple availability designs, and fitted Resource Selection Function (RSF) models to test the influence of moonlight and canopy structure on primate sleeping ecology. The deposit contains both the final dataset used in the main RSF analysis and HTML notebooks that illustrate the complete workflow step by step. Some steps require large external rasters (canopy height, Sentinel-2 NDVI) that are not distributed here, but the main model can be reproduced directly with the provided CSV.

Contents of this deposit

review_sleep_moon.csvDataset containing the complete details of all articles included in the review. Each entry lists metadata such as citation, species studied, geographic region, and whether moonlight or sleeping behavior variables were reported. This file supports transparency and reproducibility of the literature synthesis.

n10_b300_rsf.csvFinal dataset selected for the RSF analysis (10 available points per used point; 300 m buffer). This is the file used to reproduce the main statistical model.

covariates.htmlDocuments how the dataset of sleeping sites (used points) and the control points (available points) were created. Describes how available points were generated around each used point, how nightly identifiers were assigned, and how unsuitable areas were masked out.

cloud.htmlDocuments the extraction of cloud cover values from Sentinel 2-imagery and correlation calculation with daily precipitations in the study area. 

buffers_points.htmlDocuments the generation of all combinations of available-point numbers and buffer sizes (for example: n1_b100, n10_b300, etc.). Each combination is saved as a dataframe with covariates attached (canopy, NDVI, moonlight, weather). The outputs are stored together in an R list.

rsf.htmlDocuments the modeling step. It loads the list of datasets, selects the chosen design (n10_b300), fits mixed-effects logistic RSF models, performs diagnostics, and produces figures and tables. This HTML shows the full workflow even though large external raster files are not included.

Workflow summary



Sleeping-site dataset preparation (covariates.html)



Define observed (used) sites and generate matched available points.

Apply spatial mask to exclude unsuitable areas.

Assign nightly identifiers and bind used/available into one table.



Availability design alternatives (buffers_points.html)



Iterate across different numbers of available points and buffer sizes.

Attach environmental covariates from rasters and weather data.

Save all designs into a named list (all_dfs_proc.rds).



RSF modeling (rsf.html)



Load all designs from the RDS.

Select the chosen design (n10_b300).

Fit RSF models with lunar × canopy interaction and environmental covariates.

Evaluate models, run diagnostics, and produce final figures.



Final dataset for reproducibility



The CSV file n10_b300_rsf.csv contains exactly the dataset used in the final RSF.

With this single file, the main model can be reproduced without needing the heavy raster inputs.



External data not included



The workflow shown in the HTMLs requires external geospatial datasets that are not part of this deposit due to size and licensing restrictions:

ETH Global Canopy Height (10 m) raster, used for canopy metrics.

Sentinel-2 imagery, used to calculate NDVI.

Mask shapefile to exclude unsuitable areas.

Daily weather data (precipitation and temperature).




These resources are openly available from their original providers. The included CSV already contains the extracted values needed for the RSF.