earthkit.data.targets.zarr

Attributes

Classes

ZarrTarget

Represent a target.

Module Contents

class earthkit.data.targets.zarr.ZarrTarget(**kwargs)

Bases: earthkit.data.targets.SimpleTarget

Represent a target.

Parameters:
  • encoder (str, Encoder, None) – The encoder to use to encode the data. Can be overridden in the the write method. When a string is passed, the encoder is looked up in the available encoders. When None, the encoder will be determined from the data to write (if possible) or from the Target properties.

  • template (obj, None) – The template to use to encode the data. Can be overridden in the write method.

  • metadata (dict, None) – Metadata to pass to the encoder.

:param The Target is used to write data to a specific location. The target can be: :param a file: :param a database: :param a remote server: :param etc.:

close()

Close the target and flush the fdb.

The target will not be able to write anymore.

Raises:

ValueError

property closed

True if the target is closed, False otherwise.

flush()

Flush the fdb.

Raises:

ValueError

write(data=None, **kwargs)

Write data to the target using the given encoder.

Parameters:
  • data (obj, None) – The data object to write. If None, the encoder will use all the other arguments to generate the data to write.

  • encoder (str, Encoder, None) – The encoder to use to encode the data. When a string is passed, the encoder is looked up in the available encoders. When None, the encoder the Target was created with will be used if available. Otherwise, the encoder will be determined from the data to write (if possible) or from the Target properties.

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

  • metadata (dict, None) – Metadata to pass to the encoder.

  • **kwargs (dict) – Other keyword arguments passed to the encoder.

Raises:

ValueError

earthkit.data.targets.zarr.target