-
-
Notifications
You must be signed in to change notification settings - Fork 364
Adds filters, compressors and serializer props to Array #2652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
3f14d2a
3bf61c5
635a35f
c8b96a5
3ecb781
8f2babb
b55d09d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
import numcodecs.abc | ||
import numpy as np | ||
|
||
from zarr.abc.codec import Codec | ||
from zarr.abc.codec import ArrayArrayCodec, ArrayBytesCodec, BytesBytesCodec | ||
from zarr.core.common import ZarrFormat | ||
from zarr.core.metadata.v3 import DataType | ||
|
||
|
@@ -85,9 +85,9 @@ class ArrayInfo: | |
_order: Literal["C", "F"] | ||
_read_only: bool | ||
_store_type: str | ||
_compressor: numcodecs.abc.Codec | None = None | ||
_filters: tuple[numcodecs.abc.Codec, ...] | None = None | ||
_codecs: list[Codec] | None = None | ||
_filters: tuple[numcodecs.abc.Codec, ...] | tuple[ArrayArrayCodec, ...] = () | ||
_serializer: ArrayBytesCodec | None = None | ||
_compressors: tuple[numcodecs.abc.Codec, ...] | tuple[BytesBytesCodec, ...] = () | ||
_count_bytes: int | None = None | ||
_count_bytes_stored: int | None = None | ||
_count_chunks_initialized: int | None = None | ||
|
@@ -109,18 +109,19 @@ def __repr__(self) -> str: | |
Read-only : {_read_only} | ||
Store type : {_store_type}""") | ||
|
||
kwargs = dataclasses.asdict(self) | ||
# We can't use dataclasses.asdict, because we only want a shallow dict | ||
kwargs = {field.name: getattr(self, field.name) for field in dataclasses.fields(self)} | ||
|
||
if self._chunk_shape is None: | ||
# for non-regular chunk grids | ||
kwargs["chunk_shape"] = "<variable>" | ||
if self._compressor is not None: | ||
template += "\nCompressor : {_compressor}" | ||
|
||
if self._filters is not None: | ||
if len(self._filters) > 0: | ||
|
||
template += "\nFilters : {_filters}" | ||
|
||
if self._codecs is not None: | ||
template += "\nCodecs : {_codecs}" | ||
if self._serializer is not None: | ||
template += "\nSerializer : {_serializer}" | ||
if len(self._compressors) > 0: | ||
template += "\nCompressors : {_compressors}" | ||
|
||
if self._count_bytes is not None: | ||
template += "\nNo. bytes : {_count_bytes}" | ||
|
@@ -139,5 +140,8 @@ def __repr__(self) -> str: | |
kwargs["_storage_ratio"] = f"{self._count_bytes / self._count_bytes_stored:.1f}" | ||
|
||
if self._count_chunks_initialized is not None: | ||
template += "\nChunks Initialized : {_count_chunks_initialized}" | ||
if self._shard_shape is not None: | ||
template += "\nShards Initialized : {_count_chunks_initialized}" | ||
else: | ||
template += "\nChunks Initialized : {_count_chunks_initialized}" | ||
return template.format(**kwargs) |
Uh oh!
There was an error while loading. Please reload this page.