Skip to contents

ERA5_extract

Usage

extract.nc.ERA5(
  slat,
  slon,
  in.path,
  start_date,
  end_date,
  outfolder,
  in.prefix,
  newsite,
  ncores = 1,
  vars = NULL,
  overwrite = FALSE,
  verbose = FALSE,
  ...
)

Arguments

slat

numeric: vector of latitudes.

slon

numeric: vector of longitudes.

in.path

character: path to the directory containing the file to be inserted

start_date

character: start date (in YYYY-MM-DD format).

end_date

character: end date (in YYYY-MM-DD format).

outfolder

character: Path to directory where nc files need to be saved.

in.prefix

character: initial portion of the filename that does not vary by date. Does not include directory; specify that as part of in.path.

newsite

character: vector of site names. The length should match with that of slat and slon.

ncores

numeric: the number of CPUs for the parallel compute. Default is 1.

vars

character: names of variables to be extracted. If NULL all the variables will be returned. Default is NULL.

overwrite

Logical if files needs to be overwritten.

verbose

Decide if we want to stop printing info.

...

other inputs.

Value

a list of xts objects with all the variables for the requested years

Details

For the list of variables check out the documentation at https://confluence.ecmwf.int/display/CKB/ERA5+data+documentation#ERA5datadocumentation-Spatialgrid

Author

Dongchen Zhang, Akash

Examples

if (FALSE) { # \dontrun{
point.data <- extract.nc.ERA5(
  slat = 43.25,
  slon = -83.25,
  in.path = "path/to/era5/files",
  start_date = "1990-01-01",
  end_date = "1995-12-31",
  outfolder = "path/to/output",
  in.prefix = "ERA5_",
  newsite = "my_site",
  vars = NULL,
  overwrite = FALSE,
  verbose = TRUE
)

} # }