Repository containing all the code and data to simulate different microclimates for Reyes-Puig et al. 2026 Physiology-microhabitat matching may help organisms cope with the thermal and hydric challenges under climate change: a tale of two lizards (Ecography)
收藏资源简介:
This repository contains all the code and data to simulate different microclimates. We simulate different microclimates in Castro São Paio using NicheMapR. The weather data comes from Modivas (https://www.wunderground.com/dashboard/pws/IMODIV1). Repository structure /code/ aux_functions.R: helpful functions to handle data readLoggers: reads and cleans datalogger data given the logger name and timeperiod. read.logger: reads the data from iButton csv files. Internal of readLoggers. clean.logger: cleans datalogger data, and formats dates. Internal of readLoggers. clean.logger2: same as clean.logger but for a different time format. Internal of readLoggers. prepare.weather: adds logger data to the weather station data. Internal of run.microclimate. retrieve.output: retrieves output of the microclimate model. Internal of run.microclimate. run.microclimate: runs the model, if needed it prepares the weather data, and finally retrieves the data from the model. plot.predictions: plot simulation predictions and datalogger observations. site.info: get coordinates, elevation, slope and aspect for each site from the datalogger table. micro_custom.R: Function to prepare the input for NicheMapR microclimate model and run the model. microclimate_hourly_Castro.R: example script that shows how to use hourly data from weather stations as input for the NicheMapR microclimate model. prepare_rasters.R: script used to compute the slope and aspect in the study area, and save the files in the terrain folder. prepare_weather.R: script used to download and prepare the weather data from Modivas station, which is then saved in the weather folder. The script can download data from any station, if you supply its code in wunderground. read_dataLoggers.R: example script to read and plot datalogger data (Old). /dataloggers_Castro/ datalogger data on temperature and humidity. /terrain/ marrisk-2019-02-20-dsm.tif: digital elevation model of Castro Saõ Paio. marrisk-2019-02-20-dsmshd.tif: digital elevation model (shade). marrisk-2019-02-20-orto.tif: ortophoto. slope.tif: slope for the area where dataloggers where placed. aspect.tif: aspect for the area where dataloggers where placed. /weather/ weather data from Modiva station, downloaded from wunderground. microclimates_CastroSampaio.Rmd: Run simulations for different microhabitats and compare to the data recorded by iButtons placed in those microclimates.
本仓库包含用于模拟不同微气候的全部代码与数据集。 我们借助NicheMapR(NicheMapR)工具包,在Castro São Paio地区开展各类微气候模拟实验。所用气象数据源自Modivas站点(https://www.wunderground.com/dashboard/pws/IMODIV1)。 ## 仓库结构 ### /code/ 目录 1. `aux_functions.R`:用于数据处理的辅助工具函数 2. `readLoggers`:根据数据日志器名称与时间周期,读取并清理数据日志器数据,其内部包含以下子函数: - `read.logger`:读取纽扣式数据记录器(iButton)的CSV格式文件数据,为`readLoggers`的内部函数。 - `clean.logger`:清理数据日志器数据并格式化日期字段,为`readLoggers`的内部函数。 - `clean.logger2`:功能与`clean.logger`一致,但适配不同的时间格式,为`readLoggers`的内部函数。 3. `prepare.weather`:将数据日志器数据整合至气象站数据中,为`run.microclimate`的内部函数。 4. `retrieve.output`:获取微气候模型的输出结果,为`run.microclimate`的内部函数。 5. `run.microclimate`:运行微气候模型,若有需要则先完成气象数据准备,最终提取模型输出数据。 6. `plot.predictions`:绘制微气候模拟预测结果与数据日志器观测值的对比图。 7. `site.info`:从数据日志器数据表中提取各监测站点的坐标、海拔、坡度与坡向信息。 8. `micro_custom.R`:用于准备NicheMapR微气候模型输入参数并运行模型的自定义函数。 9. `microclimate_hourly_Castro.R`:示例脚本,展示如何将气象站逐小时数据作为输入,运行NicheMapR微气候模型。 10. `prepare_rasters.R`:用于计算研究区域内坡度与坡向栅格数据,并将结果保存至`terrain`文件夹的脚本。 11. `prepare_weather.R`:用于下载并预处理Modivas站点的气象数据,结果保存至`weather`文件夹的脚本。若提供Wunderground平台上的其他站点代码,该脚本可支持下载任意站点的气象数据。 12. `read_dataLoggers.R`:用于读取并绘制数据日志器数据的示例脚本(旧版)。 ### `/dataloggers_Castro/` 目录 存储Castro São Paio地区的温度与湿度数据日志采集数据。 ### `/terrain/` 目录 1. `marrisk-2019-02-20-dsm.tif`:Castro São Paio地区的数字高程模型(DSM) 2. `marrisk-2019-02-20-dsmshd.tif`:带阴影效果的数字高程模型 3. `marrisk-2019-02-20-orto.tif`:研究区正射影像 4. `slope.tif`:数据日志器布设区域的坡度栅格数据 5. `aspect.tif`:数据日志器布设区域的坡向栅格数据 ### `/weather/` 目录 存储从Wunderground平台下载的Modivas站点气象数据。 `microclimates_CastroSampaio.Rmd`:用于运行不同微生境的微气候模拟实验,并将模拟结果与布设在对应微气候环境中的iButton记录的实测数据进行对比分析。



