https://github.com/asdf-format/asdf-compression
https://github.com/asdf-format/asdf-compression
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/asdf-format/asdf-compression
- Owner: asdf-format
- License: bsd-3-clause
- Created: 2023-06-27T14:49:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-11-10T17:32:10.000Z (7 months ago)
- Last Synced: 2025-11-10T19:11:11.810Z (7 months ago)
- Language: Python
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
ASDF support for various compression algorithms
-----------------------------------------------
.. image:: https://github.com/asdf-format/asdf-compression/workflows/CI/badge.svg
:target: https://github.com/asdf-format/asdf-compression/actions
:alt: CI Status
This packages includes a plugin for the Python library
`asdf `__ to add support
for reading and writing various compression algorithms including:
* `Blosc `__
* `LZ4 Frame `__
* `Zstandard `__
Installation
------------
This plugin is not yet stable and released on PyPi.
To install all compression algorithms supported by asdf-compression, install
using the ``all`` optional parameters.
.. code-block:: console
$ pip install "asdf-compression[all] @ git+https://github.com/asdf-format/asdf-compression"
Or alternatively by cloning and installing this repository.
.. code-block:: console
$ git clone https://github.com/asdf-format/asdf-compression
$ cd asdf-compression
$ pip install ".[all]"
If only a specific algorithm is needed, just that algorithm can be installed.
.. code-block:: console
$ pip install ".[zstd]"
Or a subset can be selected
.. code-block:: console
$ pip install ".[zstd,blsc]"
Usage
-----
When installed ``asdf-compression`` will register any supported and available
compression algorithms with asdf using the
`Compressor `__
interface.
The following example shows saving an array with ``zstandard`` compression provided
via ``asdf-compression``.
.. code-block:: python
import asdf, numpy as np
af = asdf.AsdfFile({"arr": np.arange(42)})
af.set_array_compression(af["arr"], "zstd")
af.write_to("test.asdf")
Testing
-------
`pytest `__ is used for testing.
Tests can be run (from the source checkout of this repository):
.. code-block:: console
$ pytest
Contributing
------------
We welcome feedback and contributions to this project.