earthkit.data.field.xarray.time

Classes

XArrayTimeHandler

Time component of a field.

Functions

from_xarray(owner, selection)

Module Contents

class earthkit.data.field.xarray.time.XArrayTimeHandler(owner, selection)

Bases: earthkit.data.field.handler.time.TimeFieldComponentHandler

Time component of a field.

COMPONENT_CLS
COMPONENT_MAKER
KEYS = ()
NAME = 'time'
check(owner)

Default check implementation.

property component: Any

Return the component object.

classmethod create_empty()
dump(owner, name, result, prefix_keys=False)

Populate the namespace dictionary for this SpecFieldComponent.

classmethod from_any(data, dict_kwargs=None)

Create a SimpleFieldComponent object from any input.

Parameters:
  • data (Any) – The input data from which to create the SimpleFieldComponent instance.

  • dict_kwargs (dict, optional) – Additional keyword arguments to be passed when creating the instance from a dictionary.

Returns:

An instance of SimpleFieldComponentHandler. If the input is already an instance of SimpleFieldComponentHandler, it is returned as is. Otherwise, it is assumed to be a component object and a new SimpleFieldComponentHandler instance is created from it.

Return type:

SimpleFieldComponentHandler

classmethod from_component(component)

Create a SimpleFieldComponent object from a component object.

classmethod from_dict(d, **kwargs)

Create a SimpleFieldComponent object from a dictionary.

get(key, default=None, *, astype=None, raise_on_missing=False)

Return the value for key.

Parameters:
  • key (str) – Key

  • default (value) – Specify the default value for key. Returned when key is not found or its value is a missing value and raise_on_missing is False.

  • astype (type as str, int or float) – Return/access type for key. When it is supported astype is passed to the underlying accessor as an option. Otherwise the value is cast to astype after it is taken from the accessor.

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

Returns:

Returns the key value. Returns default if key is not found or it has a missing value and raise_on_missing is False.

Return type:

value

Raises:

KeyError – If raise_on_missing is True and key is not found or it has a missing value.

get_grib_context(context)

Populate the GRIB context dictionary for this FieldComponent.

owner
selection
set(*args, **kwargs)

Create a new SimpleFieldComponentHandler instance with updated component data.

earthkit.data.field.xarray.time.from_xarray(owner, selection)