bluegreen-labs/ecmwfr

wf_request Error

tanthiamhuat opened this issue · 1 comments

I run the below code:

library(ecmwfr)
myUID <- "xxxyyy"
wf_set_key(user=myUID, key='----******', service='cds')
--# above line for wf_set_key is OK

--# Specify the data set
request <- list(
"dataset" = 'projections-cmip5-monthly-single-levels',
'variable' = '2m_temperature',
'model' = 'noresm1_m',
'experiment' = 'historical',
'ensemble_member' = 'r1i1p1',
'period' = '185001-200512',
'target' = 'download_CMIP5.nc')

--# Start downloading the data, the path of the file
--# will be returned as a variable (ncfile)
--# Set your UID properly and the path where to find .cdsapirc

ncfile <- wf_request(user = myUID,
request = request,
transfer = TRUE,
path = "C:\Users\tanthiamhuat",
verbose = FALSE)
Running above just give Error: but did not state why or what is the error.

This works for me. There is probably an error in your query somewhere.

Always use the RStudio addin for formatting queries.

options(keyring_backend="file")
library(ecmwfr)

request <- list(
  ensemble_member = "r1i1p1",
  format = "zip",
  variable = "2m_temperature",
  experiment = "historical",
  model = "noresm1_m",
  period = "185001-200512",
  dataset_short_name = "projections-cmip5-monthly-single-levels",
  target = "download.zip"
)

# If you have stored your user login information
# in the keyring by calling cds_set_key you can
# call:
file <- wf_request(
  user     = "XXXX",   # user ID (for authentification)
  request  = request,  # the request
  transfer = TRUE,     # download the file
  path     = ".")      # store data in current working directory