earthkit.data.encoders.text

Attributes

Classes

TextEncoder

Encode text data.

Module Contents

class earthkit.data.encoders.text.TextEncoder(**kwargs)

Bases: earthkit.data.encoders.Encoder

Encode text data.

encode(data=None, target=None, **kwargs)

Encode the data.

Parameters:
  • data (obj, None) – The data to encode. Should be used via double dispatch. Must have an _encode() method, which will call the appropriate _encode_* method on the Encoder.

  • values (obj, None) – The values to encode.

  • check_nans (bool) – If True, check for NaN values in the data and replace them with the missing_value.

  • metadata (dict) – Metadata to use when encoding the data. When None, the metadata the Encoder was created with will be used if available.

  • template (obj, None) – The template to use to encode the data. When None, the template the Encoder was created with will be used if available.

  • missing_value (number) – The value to use for missing values.

  • target (Target, None) – The target to write to. Can be used by the encoder to determine how to encode the data. When None, the encoder will determine the target from the data to write (if possible) or from the Encoder properties.

  • **kwargs (dict) – Additional keyword arguments.

Returns:

The encoded data.

Return type:

EncodedData

metadata
template = None
earthkit.data.encoders.text.encoder