This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(ecmwfr)
wf_set_key("38603", "e2a27a8e-18ee-47f8-a169-ade2b4385efd", service='cds')
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## User 38603 for cds service added successfully
library(ncdf4)
library(raster)
## Loading required package: sp
library(maps)
request <- list("dataset" = "reanalysis-era5-pressure-levels",
"product_type" = "reanalysis",
"variable" = "temperature",
"pressure_level" = "850",
"year" = "2000",
"month" = "04",
"day" = "04",
"time" = "00:00",
"area" = "60/-10/50/5",
"format" = "netcdf",
"target" = "era5-demo.nc")
ncfile <- wf_request(user = "38603",request = request,
transfer = TRUE,
path = "~",
verbose = FALSE)
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
##
|
| | 0%
|
|======================================================================| 100%
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
## Warning in default_backend_auto(): Selecting 'env' backend. Secrets are stored
## in environment variables
r <- raster::raster(ncfile)
raster::plot(r, main = "ERA-5 Reanalysis Demo (2m Temperature 850 hPa)")
maps::map("world", add = TRUE)