earthkit.data.encoders.csv¶
Attributes¶
Classes¶
Base class for representing encoded data. |
|
Base class for encoders. |
Module Contents¶
- class earthkit.data.encoders.csv.CSVEncodedData(df)¶
Bases:
earthkit.data.encoders.EncodedDataBase class for representing encoded data.
It is meant to be used by a
Targetto write/add data to a given target. It is the return value from theEncoder.encode()method.- df¶
- abstractmethod get(key, default=None)¶
- prefer_file_path = False¶
- abstractmethod to_bytes()¶
Return the data as a bytesarray.
- to_file(f, **kwargs)¶
Write the data to a file.
- Parameters:
f (
file-like object) – File-like object to write to
- class earthkit.data.encoders.csv.CSVEncoder(**kwargs)¶
Bases:
earthkit.data.encoders.EncoderBase class for encoders.
An encoder is used to encode data to a specific format that can be used by a
Target.- Parameters:
- 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 theEncoder.values (
obj,None) – The values to encode.check_nans (
bool) – If True, check for NaN values in the data and replace them with themissing_value.metadata (
dict) – Metadata to use when encoding the data. When None, the metadata theEncoderwas created with will be used if available.template (
obj,None) – The template to use to encode the data. When None, the template theEncoderwas 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 theEncoderproperties.**kwargs (
dict) – Additional keyword arguments.
- Returns:
The encoded data.
- Return type:
EncodedData
- metadata¶
- template = None¶
- earthkit.data.encoders.csv.encoder¶