earthkit.data.readers.bufr.message

Classes

BUFRMessage

Represent a BUFR message in a BUFR file.

Module Contents

class earthkit.data.readers.bufr.message.BUFRMessage(path, offset, length)

Bases: earthkit.data.core.Base

Represent a BUFR message in a BUFR file.

Parameters:
  • path (str) – Path to the BUFR file

  • offset (number) – File offset of the message (in bytes)

  • length (number) – Size of the message (in bytes)

describe(subset=1)

Generate a dump with the message content represented as a tree view in a Jupyter notebook.

Parameters:

subset (int) – Subset to dump. Please note that susbset indexing starts at 1. Use None to dump all the subsets in the message.

Returns:

Dump contents represented as a tree view in a Jupyter notebook.

Return type:

HTML

Examples

BUFR: using TEMP data

get(keys=None, default=None, *, astype=None, raise_on_missing=False, output='auto', flatten_dict=False, remapping=None, patch=None)

Return the values for the specified keys.

Parameters:
  • keys (str, list or tuple) – Keys to get the values for.

  • default (value) – Default value to return when a key is not found or it has a missing value.

  • raise_on_missing (bool) – When it is True raises an exception if a key is not found or it has a missing value.

Returns:

A dictionary with keys and their values.

Return type:

dict

is_compressed()

Check if the BUFR message contains compressed subsets.

is_coord(key)

Check if the specified key is a BUFR coordinate descriptor.

Parameters:

key (str) – Key name (can contain ecCodes rank)

Returns:

True if the specified key is a BUFR coordinate descriptor

Return type:

bool

is_uncompressed()

Check if the BUFR message contains uncompressed subsets.

message()

Return a buffer containing the encoded message.

Return type:

bytes

metadata(keys, *, astype=None, output='auto', remapping=None, patch=None)
pack()

Encode the data section of the message. Having called pack the contents of only the header keys become available via metadata. To access the data section you need to use unpack again.

See also

unpack

path
subset_count()

Return the number of subsets in the given BUFR message.

unpack()

Decode the data section of the message. When a message is unpacked all the keys in the data section become available via metadata.

See also

unpack