## Not run:
# library(ncdf4)
#
# filename <- paste0(tempfile(), ".nc")
#
# # API call to CAMS
# r <- cams_api(
# 60, 15, # latitude=60, longitude=15
# "2016-06-01", "2016-06-10", # for 2016-06-01 to 2016-06-10
# time_step="PT01H", # hourly data
# service="get_cams_radiation", # CAMS radiation
# format="application/x-netcdf",# netCDF format
# filename=filename) # file to save to
#
# # Access the on disk stored ncdf4 file
# nc <- nc_open(r$response$content)
# # list names of available variables
# names(nc$var)
#
# # create data.frame with timestamp and global horizontal irradiation
# df <- data.frame(datetime=as.POSIXct(nc$dim$time$vals, "UTC",
# origin="1970-01-01"),
# GHI = ncvar_get(nc, "GHI"))
#
# plot(df, type="l")
#
# nc_close(nc)
# ## End(Not run)
Run the code above in your browser using DataLab