Download archived model data from the NOMADS server.

Share:

Description

This function interfaces with the programming API at http://nomads.ncdc.noaa.gov/ to download 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.

Usage

1
2
3
ArchiveGribGrab(abbrev, model.date, model.run, pred,
    local.dir = ".", file.name = "fcst.grb", 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)

pred

Which prediction to get (analysis is 00)

local.dir

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

file.name

What to name the grib file, defaults to "fcst.grb".

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$local.dir

The absolute path to the grib file that was downloaded.

grib.info$file.name

The 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 daniel.bowman@unc.edu

References

http://nomads.ncdc.noaa.gov/

See Also

CheckNOMADSArchive, NOMADSArchiveList, ReadGrib

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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
pred <- 3

## Not run: 
model.info <- ArchiveGribGrab(abbrev, model.date, 
    model.run, pred, file.type = "grib2")
model.data <- ReadGrib(model.info$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)