# NOT RUN {
#An example for the Global Forecast System
#Get data for January 1 2014
#Temperature at 2 m above ground
#3 hour prediction
# using GRIB
abbrev <- "gfsanl"
model.date <- 20140101
model.run <- 06
preds <- 3
# }
# NOT RUN {
model.info <- ArchiveGribGrab(abbrev, model.date,
model.run, preds, file.type = "grib2")
model.data <- ReadGrib(model.info[[1]]$file.name, c("2 m above ground"), c("TMP"))
#Get surface temperature in Chapel Hill, NC
lat <- 35.907605
lon <- -79.052147
profile <- BuildProfile(model.data, lon, lat, TRUE)
print(paste0("The temperature prediction in Chapel Hill was ",
sprintf("%.0f", profile[[1]]$profile.data[1,1,1] - 272.15), " degrees Celsius."))
# }
Run the code above in your browser using DataLab