Last chance! 50% off unlimited learning
Sale ends in
ReadGrib
.GribGrab(levels, variables, local.dir = ".", file.name = "fcst.grb",
model.date = Sys.time(), fcst.date = Sys.time(),
model.domain = NULL, tidy = FALSE, verbose = TRUE)
"fcst.grb"
.TRUE
, remove all files with the suffix ".grb" from local.dir
prior to downloading a new grib file.TRUE
, give information on connection status. Default TRUE
file.name
is the name of the grib file that was downloaded.GribGrab
to fail.
In this case, wait an hour or two and try again.GetModelRunHour
#Get the latest model date
model.date <- Sys.time()
#Get the forecast 6 hours from now - addition is defined in seconds
fcst.date <- model.date + 6 * 3600
#What region of the atmosphere to get data for
levels <- c("2 m above ground", "800 mb")
#What data to return
variables <- c("TMP", "RH") #Temperature and relative humidity
#What region of the world to get data for - omit this and you get the whole planet!
model.domain <- c(-84, -74, 37, 32) #Get the area around North Carolina, USA
#Get the data
file.name <- GribGrab(levels, variables, model.date = model.date,
fcst.date = fcst.date, model.domain = model.domain)
Run the code above in your browser using DataLab