Download ERA5 meteorological data from the Copernicus Data Store (CDS). Create a free CDS user account by self registering. Once your user account has been verified you can get your personal user ID and key by visiting the user profile.
Usage
download_era5_ncdf(
lat,
lon,
variable = c("10m_u_component_of_wind", "10m_v_component_of_wind",
"2m_dewpoint_temperature", "2m_temperature", "snowfall", "surface_pressure",
"surface_solar_radiation_downwards", "surface_thermal_radiation_downwards",
"total_precipitation"),
year = 2022,
month = 1:12,
site = "test",
user = NULL,
era5_dataset = "reanalysis-era5-land",
path = ".",
job = TRUE
)
Arguments
- lat
numeric; latitude
- lon
numeric; longitude
- variable
vecto;r with string with ERA5 variable names e.g. "2m_temperature", "total_precipitation"
- year
numeric; year or vector of years.
- month
numeric; month or vector of months. Defaults to 1:12.
- site
string of site name which will be appended to the file
- user
user ID linked with Copernicus account
- era5_dataset
string; of which ERA5 dataset to use. Can be 'reanalysis-era5-single-levels' or 'reanalysis-era5-land'
- path
filepath to store downloaded file
- job
logical; send the request to a background job in RStudio. Only works in RStudio. Default = TRUE.
Examples
if (FALSE) { # \dontrun{
path <- 'era5_folder'
site <- 'lake'
ecmwfr::wf_set_key(user = '123456',
key = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
service = 'cds')
download_era5(lat = lat, lon = lon, year = 2022,
user = user, path = path)
met <- convert_era5(lat = lat, lon = lon, year = 2022,
site = site, path = path)
} # }