ArchiveGribGrab: Download archived model data from the NOMADS server.

View source: R/GetArchiveGrib.R

ArchiveGribGrabR Documentation

Download archived model data from the NOMADS server.

Description

This function gives access to archived NOMADS model data. The available models can be viewed by calling NOMADSArchiveList without arguments. The data arrives in grib (gridded binary) format that can be read with ReadGrib. Some of these files are in GRIB format, others are in GRIB2 format; select the appropriate file type when calling ReadGrib. Note that this is a legacy function that emulates the archive data retrieval capability when NOMADS NCEP used to host past data sets. At present the data are hosted on NCEI.

Usage

ArchiveGribGrab(abbrev, model.date, model.run, preds,
    local.dir = NULL, file.names = NULL, tidy = FALSE,
    verbose = TRUE, download.method = NULL, file.type = "grib2")

Arguments

abbrev

Model abbreviation per NOMADSArchiveList.

model.date

The year, month, and day of the model run, in YYYYMMDD format

model.run

Which hour the model was run (i.e. 00, 06, 12, 18 for GFS)

preds

A scalar or vector of prediction to get (analysis is 00)

local.dir

Where to save the grib file, defaults to the current directory.

file.names

A list of length length(preds) of file names to which the downloaded GRIB files are directed to. Default NULL, meaning files will be named per their model date and time.

tidy

If TRUE, remove all files with the suffix ".grb" from local.dir prior to downloading a new grib file.

verbose

If TRUE, give information on connection status. Default TRUE

download.method

Allows the user to set the download method used by download.file: "internal", "wget" "curl", "lynx". If NULL (the default), let R decide.

file.type

Determine whether to get GRIB1 ("grib1") or GRIB2 ("grib2") file formats. Sometimes both are available, sometimes only one.

Value

grib.info$file.name

The path and file name of the grib file that was downloaded.

grib.info$url

The URL that the grib file was downloaded from

Author(s)

Daniel C. Bowman danny.c.bowman@gmail.com

References

https://www.ncei.noaa.gov/data/

See Also

CheckNOMADSArchive, NOMADSArchiveList, ReadGrib

Examples

#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."))

## End(Not run)

rNOMADS documentation built on Sept. 6, 2022, 5:06 p.m.