earthkit.data.field.component.component¶
Classes¶
Functions¶
|
|
|
|
|
Module Contents¶
- class earthkit.data.field.component.component.FieldComponent¶
- abstractmethod aliases()¶
Return the aliases in the component.
- classmethod from_dict(d)¶
- Abstractmethod:
Create a FieldComponent instance from a dictionary.
- Parameters:
d (
dict) – Dictionary containing specification data.- Returns:
The created FieldComponent instance.
- Return type:
- abstractmethod get(key, default=None, *, astype=None, raise_on_missing=False)¶
Return the values for the specified keys.
- Parameters:
keys (
str,listortuple) – Specify the metadata keys to extract. Can be a single key (str) or multiple keys as a list/tuple of str.default (
Any,None) – Specify the default value(s) forkeys. Returned when the given key is not found andraise_on_missingis False. Whendefaultis a single value, it is used for all the keys. Otherwise it must be a list/tuple of the same length askeys.astype (
type as str,intorfloat) – Return type forkeys. Whenastypeis a single type, it is used for all the keys. Otherwise it must be a list/tuple of the same length askeys.raise_on_missing (
bool) – When True, raises KeyError if any ofkeysis not found.
- Returns:
The value(s) for the specified
keys:when
keysis a str returns a single valuewhen
keysis a list/tuple returns a list/tuple of values
- Return type:
single value,list,tuple- Raises:
KeyError – If
raise_on_missingis True and any ofkeysis not found.
- abstractmethod keys()¶
Return the available keys in the component.
- abstractmethod set(*args, **kwargs)¶
Create a new instance with updated data.
- Parameters:
*args – Positional arguments.
**kwargs – Keyword arguments.
- Returns:
The created FieldComponent instance.
- Return type:
- Raises:
KeyError – If any of the keys to be set are not supported.
- abstractmethod to_dict()¶
Convert the object to a dictionary.
- Returns:
Dictionary representation of the object.
- Return type:
dict
- class earthkit.data.field.component.component.SimpleFieldComponent¶
Bases:
FieldComponent- aliases()¶
Return the aliases in the component.
- classmethod from_dict(d)¶
- Abstractmethod:
Create a FieldComponent instance from a dictionary.
- Parameters:
d (
dict) – Dictionary containing specification data.- Returns:
The created FieldComponent instance.
- Return type:
- get(key, default=None, *, astype=None, raise_on_missing=False)¶
Return the value for the specified key.
- Parameters:
key (
str) – The key to retrieve.default (
Any, optional) – The default value to return if the key is not found. Default is None.astype (
type, optional) – The type to which the value should be cast. Default is None.raise_on_missing (
bool, optional) – If True, raise a KeyError if the key is not found. Default is False.
- Returns:
The value for the specified key.
- Return type:
Any- Raises:
KeyError – If
raise_on_missingis True and the key is not found.
- keys()¶
Return the available keys in the component.
- abstractmethod set(*args, **kwargs)¶
Create a new instance with updated data.
- Parameters:
*args – Positional arguments.
**kwargs – Keyword arguments.
- Returns:
The created FieldComponent instance.
- Return type:
- Raises:
KeyError – If any of the keys to be set are not supported.
- abstractmethod to_dict()¶
Convert the object to a dictionary.
- Returns:
Dictionary representation of the object.
- Return type:
dict
- earthkit.data.field.component.component.component_keys(cls)¶
- earthkit.data.field.component.component.mark_alias(name)¶
- earthkit.data.field.component.component.mark_get_key(func)¶