earthkit.data.readers.bufr.message¶
Classes¶
Represent a BUFR message in a BUFR file. |
Module Contents¶
- class earthkit.data.readers.bufr.message.BUFRMessage(path, offset, length)¶
Bases:
earthkit.data.core.BaseRepresent a BUFR message in a BUFR file.
- Parameters:
path (
str) – Path to the BUFR fileoffset (
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
- 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,listortuple) – 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
keyis 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
packthe contents of only the header keys become available viametadata. To access the data section you need to useunpackagain.See also
- path¶
- subset_count()¶
Return the number of subsets in the given BUFR message.