Logo Iris 1.12

Previous topic

iris.fileformats.grib.load_rules

Next topic

iris.fileformats.name

This Page

iris.fileformats.grib.message

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

In this module:

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

class iris.fileformats.grib.message.GribMessage(raw_message, recreate_raw, file_ref=None)

Bases: object

It is recommended to obtain GribMessage instance from the static method messages_from_filename(), rather than creating them directly.

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.

data

The data array from the GRIB message as a biggus 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).

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.

↑ top ↑

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.

class iris.fileformats.grib.message.Section(message_id, number, keys)

Bases: object

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.