earthkit.data.utils.message

Attributes

Classes

Functions

Module Contents

class earthkit.data.utils.message.CodesHandle(handle, path, offset)

Bases: eccodes.Message

KEY_TYPES
MISSING_VALUE
PRODUCT_ID = None
clone(**kwargs)
copy()

Create a copy of the current message

dump()

Print out a textual representation of the message

classmethod from_message(message)
classmethod from_sample(name)
get(name, ktype=None, **kwargs)

Get the value of a key

Parameters:
  • name (str) – Name of the key. Can be suffixed with “:str”, “:int”, or “:float” to request a specific type.

  • default (any, optional) – Value if the key is not Found, or None if not specified.

  • ktype (type) – Request a specific type for the value. Overrides the suffix in name

get_array(name)

Get the value of the given key as an array

Raises:

KeyError – If the key is not set

get_buffer()

Return a buffer containing the encoded message

abstractmethod get_data_points()
get_long(name)
get_size(name)

Get the size of the given key

Raises:

KeyError – If the key is not set

get_string(name)
is_defined(key)
is_missing(name)

Check whether the key is set to a missing value

Raises:

KeyError – If the key is not set

items(namespace=None)

Iterate over all the available key-value pairs

keys(namespace=None)

Iterate over all the available keys

offset
path
read_bytes(offset, length)
save(path)
set(name, value)

If two arguments are given, assumes this takes form of a single key value pair and sets the value of the given key. If a dictionary is passed in, then sets the values of all keys in the dictionary. Note, ordering of the keys is important. Finally, by default, checks if values have been set correctly

Raises:
  • TypeError – If arguments do not take one of the two expected forms

  • KeyError – If the key does not exist

  • ValueError – If the set value of one of the keys is not the expected value

set_array(name, value)

Set the value of the given key

Raises:

KeyError – If the key does not exist

set_double(name, value)
set_long(name, value)
set_missing(name)

Set the given key as missing

Raises:

KeyError – If the key does not exist

set_multiple(values)
set_string(name, value)
values(namespace=None)

Iterate over the values of all the available keys

write(f)
write_to(fileobj)

Write the message to a file object

class earthkit.data.utils.message.CodesMessagePositionIndex(path, parts=None, max_count=None)
MAGIC = None
VERSION = 1
lengths = None
max_count = None
offsets = None
parts = None
path
class earthkit.data.utils.message.CodesReader(path)
HANDLE_TYPE = None
PRODUCT_ID = None
at_offset(offset)
file
classmethod from_cache(path)
last
lock
path
earthkit.data.utils.message.ECC_FEATURES
class earthkit.data.utils.message.EccodesFeatures
check_clone_kwargs(**kwargs)
has_Ni_Nj_in_geo_namespace()
property version
property versions
class earthkit.data.utils.message.ReaderLRUCache(size)

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

lock
readers
size
earthkit.data.utils.message.cache
earthkit.data.utils.message.check_clone_kwargs(func)