comdas.utils

Utility functions for working with compressed patches. Includes: - compress_patch() Compress an in-memory DASCore patch’s data using a specified codec.

Functions

compress_patch(patch, codec, **encode_kwargs)

Return a new dascore.Patch whose data is compressed with codec.

comdas.utils.compress_patch(patch, codec, **encode_kwargs)

Return a new dascore.Patch whose data is compressed with codec.

Coords and attrs are unchanged. The returned Patch is an ordinary Patch (via patch.new) with the internal data replaced by a DuckArray.

Parameters:
  • patch (dascore.Patch) – The uncompressed source patch.

  • codec (Codec) – The codec to compress patch.data with.

  • encode_kwargs – Forwarded verbatim to codec.encode.

Returns:

A new Patch with the same coords/attrs, backed by a DuckArray.

Return type:

dascore.Patch