Skip to contents

GRIBhandle objects are pointers to a grib message that is loaded in memory. They can be read from a file (or raw binary string) with Ghandle or created by Gcreate. GRIBhandle objects are similar to connections in R. They can be closed explicitely, but this is not really necessary in general, unless you have many open handles containing large fields. Freeing a GRIBhandle also frees the memory that contains the GRIB message.

Usage

Ghandle(x, message=NULL, multi=FALSE, keys=list(shortName="2t"))
  GhandleList()
  GhandleCount()
  GhandleFree(gribhandle)
  GhandleFreeAll()

Arguments

x

A GRIBlist class object, the name of a GRIB file or a raw GRIB message.

message

An integer indicating the position in the list of the message to be opened. It may also be a list off eccodes key values. In that case, the first message that fits all keys is returned.

multi

Set to TRUE for experimental support of multi-message GRIB records.

gribhandle

A GRIBhandle

Value

  • Ghandle returns a GRIBhandle class object.

  • GhandleList() returns a list of current GRIBhandles.

  • GhandleCount() returns teh number of handles.

  • GhandleFree() clears a GRIBhandle.

  • GhandleFreeAll() clears all GRIBhandles.

Details

GRIBhandles are objects that store a pointer to some GRIB message in memory. If x is a raw vector, it is supposed to be a single GRIB message (message, multi are ignored).

See also

Examples

if (FALSE) {
#Get 5th message in a file.
h1 <- Ghandle('filename',5)
GhandleList()
GhandleFree(h1)
}