https://github.com/blosc/pycblosc
A low level Python interface to the C-Blosc library
https://github.com/blosc/pycblosc
Last synced: 3 months ago
JSON representation
A low level Python interface to the C-Blosc library
- Host: GitHub
- URL: https://github.com/blosc/pycblosc
- Owner: Blosc
- License: other
- Created: 2018-02-28T13:51:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T17:58:51.000Z (almost 8 years ago)
- Last Synced: 2025-10-11T20:52:12.876Z (3 months ago)
- Language: Python
- Size: 30.3 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PyCBlosc
A simple Python/CFFI interface for the C-Blosc library.
This tries to be a low level interface for C-Blosc. Maybe in the future more high-level function could be added too.
This package is meant to be used in either Python 2 or 3.
## Simple usage
```
In [1]: import numpy as np
In [2]: import pycblosc as cblosc
# Create an input buffer
In [3]: a = np.arange(1000_000, dtype=np.int32)
# Create a buffer for compression
In [4]: b = np.empty(1000_000, dtype=np.int32)
# Create a buffer for decompression
In [5]: c = np.empty(1000_000, dtype=np.int32)
# Compress!
In [6]: cblosc.compress(7, cblosc.SHUFFLE, a.dtype.itemsize, a.size * a.dtype.itemsize, a, b, b.size * b.dtype.itemsize)
Out[6]: 36256
# Decompress!
In [7]: cblosc.decompress(b, c, c.size * c.dtype.itemsize)
Out[7]: 4000000
# Check for equality
In [8]: np.testing.assert_array_equal(a, c)
```
## Installation
```
$ python setup.py install
```
## Testing
```
$ py.test tests
```
or, for testing with different Python (2 and 3) interpreters:
```
$ make test
```
## Authors
* **Francesc Alted**