earthkit.data.readers.grib.handle

Attributes

Classes

Module Contents

class earthkit.data.readers.grib.handle.DeflatedGribHandle(handle, bits_per_value=None)

Bases: MemoryGribHandle

A GribHandle that has been shrunk to only contain the headers.

bits_per_value = None
deflate()

Deflate the handle to only contain the headers.

classmethod from_handle(handle, bits_per_value=None)
classmethod from_message(message)

Create a MemoryGribHandle from an existing handle.

classmethod from_raw_handle(handle)

Create a MemoryGribHandle from an existing handle.

property handle
release()
class earthkit.data.readers.grib.handle.FileGribHandle(path, offset, length)

Bases: GribHandle

deflate()

Shrink the memory used by the handle.

static from_part(part, policy, manager=None)
property handle
length
offset
path
release()
class earthkit.data.readers.grib.handle.GribCodesFloatArrayAccessor
HAS_FLOAT_SUPPORT = None
KEY = None
get(handle, dtype=None)
class earthkit.data.readers.grib.handle.GribCodesHandle(handle, path, offset)

Bases: earthkit.data.utils.message.CodesHandle

KEY_TYPES
MISSING_VALUE
PRODUCT_ID = 1
as_namespace(namespace, param='shortName', prefix='')
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_latitudes(dtype=None)
get_long(name)
get_longitudes(dtype=None)
get_md5GridSection()
get_size(name)

Get the size of the given key

Raises:

KeyError – If the key is not set

get_string(name)
get_values(dtype=None)
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)
set_values(values)
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.readers.grib.handle.GribCodesLatitudeAccessor

Bases: GribCodesFloatArrayAccessor

HAS_FLOAT_SUPPORT = None
KEY = 'latitudes'
get(handle, dtype=None)
class earthkit.data.readers.grib.handle.GribCodesLongitudeAccessor

Bases: GribCodesFloatArrayAccessor

HAS_FLOAT_SUPPORT = None
KEY = 'longitudes'
get(handle, dtype=None)
class earthkit.data.readers.grib.handle.GribCodesReader(path)

Bases: earthkit.data.utils.message.CodesReader

HANDLE_TYPE
PRODUCT_ID = 1
at_offset(offset)
file
classmethod from_cache(path)
last
lock
path
class earthkit.data.readers.grib.handle.GribCodesValueAccessor

Bases: GribCodesFloatArrayAccessor

HAS_FLOAT_SUPPORT = None
KEY = 'values'
get(handle, dtype=None)
class earthkit.data.readers.grib.handle.GribHandle
deflate()

Shrink the memory used by the handle.

abstract property handle
abstractmethod release()
class earthkit.data.readers.grib.handle.GribHandleCache(cache_size=None)
cache
cache_size = None
get(handle, create)
lock
remove(handle)
earthkit.data.readers.grib.handle.LATITUDE_ACCESSOR
earthkit.data.readers.grib.handle.LONGITUDE_ACCESSOR
class earthkit.data.readers.grib.handle.ManagedGribHandle(path, offset, length, manager)

Bases: FileGribHandle

A GribHandle that is managed by a handle manager.

deflate()

Shrink the memory used by the handle.

static from_part(part, policy, manager=None)
property handle
length
manager
offset
path
release()
class earthkit.data.readers.grib.handle.MemoryGribHandle(handle)

Bases: GribHandle

deflate()

Shrink the memory used by the handle.

classmethod from_message(message)

Create a MemoryGribHandle from an existing handle.

classmethod from_raw_handle(handle)

Create a MemoryGribHandle from an existing handle.

property handle
release()
class earthkit.data.readers.grib.handle.TemporaryGribHandle(path, offset, length)

Bases: FileGribHandle

deflate()

Shrink the memory used by the handle.

static from_part(part, policy, manager=None)
property handle
length
offset
path
release()
earthkit.data.readers.grib.handle.VALUE_ACCESSOR