Climatology Lab TerraClimate

Mitchell Manware

2025-01-07

This vignette demonstrates how to download, process, and calculate covariates from the Climatology Lab’s TerraClimate dataset using amadeus functions. Details are provided for each function’s parameters and outputs. The examples utilize monthly wind speed data. See https://www.climatologylab.org/wget-terraclimate.html for full variable names and acronyms. The messages returned by amadeus functions have been omitted for brevity.

Download

Start by downloading the netCDF data files with download_data.

dir <- tempdir()
amadeus::download_data(
  dataset_name = "terraclimate",
  variable = "Wind Speed",
  year = c(2021, 2022),
  directory_to_save = dir,
  acknowledgement = TRUE,
  download = TRUE,
  remove_command = TRUE,
  hash = TRUE
)
[1] "344cddba906371b701f661ccebeef3f427b2d8ec"

Check the downloaded netCDF files.

list.files(dir, recursive = TRUE, pattern = "ws")
[1] "ws/ws_2021.nc" "ws/ws_2022.nc"

Process

Import and process the downloaded netCDF files with process_covariates.

Parameters:

ws_process <- amadeus::process_covariates(
  covariate = "terraclimate",
  variable = "Wind Speed",
  date = c("2021-12-28", "2022-01-03"),
  path = file.path(dir, "/ws")
)

Check the processed SpatRaster object. Note Climatology Lab TerraClimate is a monthly dataset, so the SpatRaster contains two layers for December 2021 and January 2022.

ws_process
class       : SpatRaster 
dimensions  : 4320, 8640, 2  (nrow, ncol, nlyr)
resolution  : 0.04166667, 0.04166667  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +no_defs 
sources     : ws_2021.nc  
              ws_2022.nc  
varnames    : ws (wind speed) 
              ws (wind speed) 
names       : ws_202112, ws_202201 
unit        :       m/s,       m/s 
time (days) : 2021-12-01 to 2022-01-01 
terra::plot(ws_process[[1]])

Calculate covariates

Covariate calculation with Climatology Lab TerraClimate data is undergoing updates.