grib_raw_split: Parse a raw GRIB message

View source: R/Rgrib.R

grib_raw_splitR Documentation

Parse a raw GRIB message

Description

Handle raw GRIB messages by identifying the location of seperate records.

Usage

  grib_raw_find(msg)
  grib_raw_split(msg)
  find_in_raw(msg, pattern="GRIB")

Arguments

msg

a 'raw' vector, supposedly containing one or more GRIB records.

pattern

A character string (ASCII) to be searched in the raw message.

Value

find_in_raw returns a vector of the indices in the raw message where the pattern was found. grib_raw_find returns a data.frame with columns begin and end with the indices of all seperate GRIB records. grib_raw_split returns a list of all seperate raw GRIB records.

See Also

Gopen, Ghandle

Examples

## Not run: 
#Get first 5 records of a file.
gzf <- gzfile("some_zipped_gribfile", "rb")
msg <- readBin(gzf, what="raw", n=2E7)
# decode second record:
Gdec(msg, 2)
# or
glist <- grib_raw_split(msg)
mydata <- Gdec(glist[[2]])

## End(Not run)

harphub/Rgrib2 documentation built on June 4, 2024, 7:27 a.m.