No project description provided
Project description
Zarrita
Zarrita is an experimental implementation of Zarr v3 including sharding. This is only a technical proof of concept meant for generating sample datasets. Not recommended for production use.
Setup
import zarrita
import numpy as np
store = zarrita.FileSystemStore('file://./testdata')
Create an array
a = zarrita.Array.create(
store,
'array',
shape=(6, 10),
dtype='int32',
chunk_shape=(2, 5),
codecs=[zarrita.codecs.gzip_codec(level=1)],
attributes={'question': 'life', 'answer': 42}
)
a[:, :] = np.ones((6, 10), dtype='int32')
Open an array
a = zarrita.Array.open(store, 'array')
assert np.array_equal(a[:, :], np.ones((6, 10), dtype='int32'))
Create an array with sharding
a = zarrita.Array.create(
store,
'sharding',
shape=(16, 16),
dtype='int32',
chunk_shape=(16, 16),
chunk_key_encoding=('v2', '.'),
codecs=[
zarrita.codecs.sharding_codec(
chunk_shape=(8, 8),
codecs=[zarrita.codecs.gzip_codec(level=1)]
),
],
)
data = np.arange(0, 16 * 16, dtype='int32').reshape((16, 16))
a[:, :] = data
assert np.array_equal(a[:, :], data)
Create a group
g = zarrita.Group.create(store, 'group')
g2 = g.create_group('group2')
a = g2.create_array(
'array',
shape=(16, 16),
dtype='int32',
chunk_shape=(16, 16),
)
a[:, :] = np.arange(0, 16 * 16, dtype='int32').reshape((16, 16))
Open a group
g = zarrita.Group.open(store, 'group')
g2 = g['group2']
a = g['group2/array']
assert np.array_equal(a[:, :], np.arange(0, 16 * 16, dtype='int32').reshape((16, 16)))
Credits
This is a largely-rewritten fork of zarrita
by @alimanfoo. It implements the Zarr v3 draft specification created by @alimanfoo, @jstriebel, @jbms et al.
Licensed under MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zarrita-0.1.0a0.tar.gz
(14.4 kB
view hashes)
Built Distribution
zarrita-0.1.0a0-py3-none-any.whl
(16.5 kB
view hashes)
Close
Hashes for zarrita-0.1.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edb48697ae29c9c0ea3bf250fa57e339e6fbe419d4d459b2cee9b54c05d2d7c0 |
|
MD5 | 565e1a103aa9306190f4895c818151d9 |
|
BLAKE2b-256 | d8e8384245b64306f27c080a31016195f6c1e12b9bab10628a6d414b3d740971 |