grib_cube: Create 3D volume of a GRIB variable

View source: R/grib_cube.R

grib_cubeR Documentation

Create 3D volume of a GRIB variable

Description

grib_cube creates a three-dimensional array from one variable along a chosen vertical coordinate.

Usage

grib_cube(gribObj, shortName, typeOfLevel, decreasing = FALSE)

Arguments

gribObj

GRIB class object.

shortName

The short name given in the GRIB file of the variable to select.

typeOfLevel

The vertical coordinate to use as given by the typeOfLevel key in the GRIB file.

decreasing

Parameter to tell the array's vertical coordinate to be increasing or decreasing.

Details

grib_cube is a wrapper function for grib_select to conveniently create a three-dimensional cube. The user inputs a variable to search for and the vertical coordinate to use when finding each level.

Because grib_cube uses grib_select, speed can become an issue. This is meant as a convenience to "get the job done". If you want more speed, it will always be better to know which message number you want, set up your own loop, and use grib_get_message as that will avoid the overhead of searching through the GRIB file.

Value

Returns a three-dimenional array.

See Also

grib_get_message grib_list grib_expand_grids grib_latlons grib_select

Examples

g <- grib_open(system.file("extdata", "lfpw.grib1", package = "gribr"))
cube <- grib_cube(g, 'u', 'isobaricInhPa', TRUE)
grib_close(g)

nawendt/gribr documentation built on July 15, 2024, 10:51 a.m.