iris_grib.message

In this module:

  • GribMessage

  • Section

Defines a lightweight wrapper class to wrap a single GRIB message.

class iris_grib.message.GribMessage(raw_message, recreate_raw, file_ref=None)

An in-memory representation of a GribMessage, providing access to the data() payload and the metadata elements by section via the sections() property.

static messages_from_filename(filename)

Return a generator of GribMessage instances; one for each message in the supplied GRIB file.

Args:

  • filename (string):

    Name of the file to generate fields from.

property data

The data array from the GRIB message as a dask Array.

The shape of the array will match the logical shape of the message’s grid. For example, a simple global grid would be available as a 2-dimensional array with shape (Nj, Ni).

property sections

Return the key-value pairs of the message keys, grouped by containing section.

Sections in a message are indexed by GRIB section-number, and values in a section are indexed by key strings.

class iris_grib.message.Section(message_id, number, keys)

A Section of a GRIB message, supporting dictionary like access to attributes using gribapi key strings.

Values for keys may be changed using assignment but this does not write to the file.

get_computed_key(key)

Get the computed value associated with the given key in the GRIB message.

Args:

  • key:

    The GRIB key to retrieve the value of.

Returns the value associated with the requested key in the GRIB message.

keys()

Return coded keys available in this Section.