This repository contains code and documentation for downloading and processing temperature and relative humidity for the Pantanal region using ERA5-Land datasets accessed through the Climate Data Store (CDS). The extraction is performed using the KrigR
R package, which enables spatial interpolation of ERA5-Land data at high resolution.
pantanal_climate.Rmd
: R Markdown file containing code to:- Authenticate with the CDS API
- Define the spatial and temporal extent
- Download and process temperature and dew point data from ERA5-Land
- Calculate relative humidity
- Output and organize cleaned data
pantanal_climate.html
: Rendered HTML document with code.- Recommended folder structure under the
data/
directory for reproducibility.
To download data from the CDS, you must:
- Register an account
- Accept the terms of use
- Follow the CDS API setup instructions
Install the necessary R packages:
if(!require("devtools")) install.packages("devtools")
if(!require("KrigR")) devtools::install_github("https://github.com/ErikKusch/KrigR")
install.packages(c("tidyverse", "sf", "terra", "slider"))
Ensure your working directory has the following layout:
pantanal_climate/
├── 01_get climate data.Rmd
├── 01_get climate data.html
├── pantanal_climate_data.Rproj
└── data/
├── raw/ # Raw data with locations and dates of collections
├── interim/ # Intermediate processed files from ERA5-Land
└── processed/ # Final clean datasets
You can create the directory structure in R:
dir.create("data/raw", recursive = TRUE)
dir.create("data/interim", recursive = TRUE)
dir.create("data/processed", recursive = TRUE)
- Clone this repository:
git clone https://github.com/pcarc1/pantanal_climate.git
cd pantanal_climate
-
Open RProject file (pantanal_climate_data.Rproj), then open pantanal_climate.Rmd in RStudio and run all code chunks.
-
Output files will be saved in the appropriate data/ subfolders.
This project is licensed under the MIT License. See the LICENSE file for more details.
Climate data provided by the Copernicus Climate Data Store (CDS), produced by ECMWF.