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.
Examples
if (FALSE) {
#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]])
}