Programmatic interface to the 'ECMWF' web API services. Allows for easy downloads of ECMWF public data.
Before starting save your provided ECMWF key to your local keychain. The package does not allow you to use your key inline in scripts to limit security issues when sharing scripts on github or otherwise.
# set a key to the keychain wf_set_key(email = "john.smith@example.com", key = "XXXXXXXXXXXXXXXXXXXXXX") # you can retrieve the key using wf_get_key(email = "john.smith@example.com") # the output should be the key you provided # "XXXXXXXXXXXXXXXXXXXXXX"
You can list ancillary data such as user information, datasets and services using the following calls.
# user info wf_user_info(email = "john.smith@example.com") # services wf_services(email = "john.smith@example.com") # datasets wf_datasets(email = "john.smith@example.com")
To download data use the wf_request() function, together with your email and a request string syntax as documented. Instead of json formatting the function uses a simple R list for all the arguments.
# this is an example of a request my_request <- list(stream = "oper", levtype = "sfc", param = "165.128/166.128/167.128", dataset = "interim", step = "0", grid = "0.75/0.75", time = "00/06/12/18", date = "2014-07-01/to/2014-07-31", type = "an", class = "ei", area = "73.5/-27/33/45", format = "netcdf", target = "tmp.nc") # an example download using fw_request() # using the above request list() # # data will be transferred to disk # and saved in your home directory (~) # set by the path argument wf_request( email = "john.smith@example.com", transfer = TRUE, path = "~", request = my_request)
This operation might take a while. A progress indicator will keep you informed on the status of your request. Once downloaded you can read in the data using the ncdf4 or raster packages for post-processing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.