grib_expand_grids: Expand GRIB message value grids

View source: R/grib_expand_grids.R

grib_expand_gridsR Documentation

Expand GRIB message value grids

Description

grib_expand_grids extracts the values from a GRIB message and expands them into matrix form.

Usage

grib_expand_grids(gribMessage, vector = FALSE)

Arguments

gribMessage

gribMessage class object

vector

optional logical inidicating whether or not to return as a vector. Default FALSE.

Details

grib_expand_grids is another convenience function that will format the values of the GRIB message into a matrix. In the case of a reduced grid, an interpolation will be done to expand the values accordingly.

This function is influenced by the reduced to regular C interpolation routine used in the pygrib Python module (see pygrib source).

Value

a matrix or vector of values from the GRIB message.

See Also

grib_latlons

Examples

# expand basic values grid to matrix
g <- grib_open(system.file("extdata", "lfpw.grib1", package = "gribr"))
gm <- grib_get_message(g, 1)
gm_ex <- grib_expand_grids(gm)
grib_close(g)

# expand a reduced grid (uses interpolation)
g_red <- grib_open(system.file("extdata", "reduced_latlon_surface.grib1", package = "gribr"))
gm <- grib_get_message(g_red, 1)
gm_red_ex <- grib_expand_grids(gm)
grib_close(g_red)

nawendt/gribr documentation built on Oct. 24, 2023, 6:19 a.m.