Skip to contents

This function processes CHELSA climate data, projects it to a specified reference grid, and optionally saves the output in NetCDF or TIFF format. It supports downloading data from a URL, applying a land mask, and adjusting data with scale and offset values.

Usage

CHELSA_Project(
  Metadata = NULL,
  EnvFile = ".env",
  FromHPC = TRUE,
  CompressLevel = 5,
  ReturnMap = FALSE
)

Arguments

Metadata

Single row tibble for the metadata of the input file. This should be prepared in the CHELSA_Prepare function and provided via the the CHELSA_Process function.

EnvFile

Character. Path to the environment file containing paths to data sources. Defaults to .env.

FromHPC

Logical indicating whether the work is being done from HPC, to adjust file paths accordingly. Default: TRUE.

CompressLevel

integer; specifies the compression level for the exported NetCDF file, ranging from 1 (least compression) to 9 (most compression). Defaults to 5.

ReturnMap

logical; if TRUE, the processed map (as a PackedSpatRaster object) is returned. Defaults to FALSE.

Value

Depending on the ReturnMap parameter, either a PackedSpatRaster object is returned, or nothing is returned. The function always writes NetCDF and TIFF files to disk.

Author

Ahmed El-Gabbas