GribInfo: Get grib file inventory.

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/ReadGrib.R

Description

Find out what model, date, levels, and variables are contained in a grib file.

Usage

1
GribInfo(grib.file, file.type = "grib2")

Arguments

grib.file

Full path to a grib file.

file.type

Whether the file is in grib2 format ("grib2") or grib format ("grib").

Details

This function allows you to find out what is inside an unknown grib file. It does this by performing a system call to wgrib2 or wgrib.

Value

grib.info

Inventory of the grib file. If the input is in grib2 format, you also get the grid definition.

Note

In order to use this function, you need to have installed wgrib2 (for grib2 files) or wgrib (for grib files). You can find these here: http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/ and http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html.

Author(s)

Daniel C. Bowman [email protected]

See Also

ReadGrib, GetDODSModelRunInfo, GribGrab

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
26
27
28
## Not run: 
#An example for the Global Forecast System 0.5 degree model

#Get the second latest model url, for stability
urls.out <- CrawlModels(abbrev = "gfs_0p50", depth = 2)

#Get a list of forecasts, variables and levels
model.parameters <- ParseModelPage(urls.out[2])

#Figure out which one is the 6 hour forecast
#provided by the latest model run
#(will be the forecast from 6-12 hours from the current date) 

my.pred <- model.parameters$pred[grep("06$", model.parameters$pred)]

#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

#Get the data
grib.info <- GribGrab(urls.out[2], my.pred, levels, variables)

#Print out the inventory - it should match the requested data
grib.inv <- GribInfo(grib.info[[1]]$file.name, "grib2")

## End(Not run)

rNOMADS documentation built on Jan. 15, 2018, 9:03 a.m.