| era5_bioclim | R Documentation |
End-to-end pipeline that reads ERA5-Land hourly GRIB/NetCDF files, aggregates them to CHELSA-compatible monthly climate variables, and computes the 19 standard bioclimatic variables (BIO01–BIO19).
era5_bioclim(
t2m_files,
tp_files,
year,
output = tempdir(),
to_celsius = TRUE,
variables = 1:19,
ncores = 1L,
save_monthly = FALSE
)
t2m_files |
Character vector of 12 file paths to monthly ERA5-Land hourly 2-m temperature files (one per calendar month, January–December). Each file may be GRIB or NetCDF. |
tp_files |
Character vector of 12 file paths to monthly ERA5-Land
hourly total precipitation files (same order as |
year |
Integer: the calendar year (used to determine days per month). |
output |
Character path to an output directory for GeoTIFF files. Defaults to a temporary directory. |
to_celsius |
Logical: convert temperatures to Celsius?
Default |
variables |
Integer vector of bioclimatic variables to compute
(1–19).
Default |
ncores |
Integer: OpenMP threads for aggregation. Default |
save_monthly |
Logical: write intermediate monthly GeoTIFFs?
Default |
The pipeline proceeds in three stages:
Monthly aggregation: For each of the 12 calendar months,
hourly t2m is aggregated to tas, tasmax, and
tasmin; hourly tp is summed to pr.
Stack: The 12 monthly layers are assembled into
terra::SpatRaster objects with 12 bands each.
Bioclim: bioclim_raster computes BIO01–BIO19.
A terra::SpatRaster with one layer per bioclimatic variable.
era5_t2m_to_monthly, era5_tp_to_monthly,
bioclim_raster
## Not run:
# Paths to ERA5-Land GRIB files on the HPC cluster
t2m_files <- sprintf("era5land_t2m_hourly_2020_%02d.grib", 1:12)
tp_files <- sprintf("era5land_tp_hourly_2020_%02d.grib", 1:12)
bio <- era5_bioclim(t2m_files, tp_files, year = 2020L, ncores = 4L)
terra::plot(bio[[1]]) # BIO01
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.