From 69e423e7b9cee08e9ad5d47ebca0fd6a5805a641 Mon Sep 17 00:00:00 2001 From: Julia Signell Date: Tue, 1 Jul 2025 11:09:24 -0400 Subject: [PATCH 1/3] Add human readable size for No. bytes stored in info_complete --- src/zarr/core/_info.py | 2 +- tests/test_info.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zarr/core/_info.py b/src/zarr/core/_info.py index d57d17f934..a5b14d573a 100644 --- a/src/zarr/core/_info.py +++ b/src/zarr/core/_info.py @@ -133,7 +133,7 @@ def __repr__(self) -> str: if self._count_bytes_stored is not None: template += "\nNo. bytes stored : {_count_bytes_stored}" - kwargs["_count_stored"] = byte_info(self._count_bytes_stored) + kwargs["_count_bytes_stored"] = byte_info(self._count_bytes_stored) if ( self._count_bytes is not None diff --git a/tests/test_info.py b/tests/test_info.py index 0abaff9ae7..28c8803c83 100644 --- a/tests/test_info.py +++ b/tests/test_info.py @@ -79,7 +79,7 @@ def test_array_info(zarr_format: ZarrFormat) -> None: @pytest.mark.parametrize("zarr_format", ZARR_FORMATS) -@pytest.mark.parametrize("bytes_things", [(1_000_000, "976.6K", 500_000, "500000", "2.0", 5)]) +@pytest.mark.parametrize("bytes_things", [(1_000_000, "976.6K", 500_000, "488.3K", "2.0", 5)]) def test_array_info_complete( zarr_format: ZarrFormat, bytes_things: tuple[int, str, int, str, str, int] ) -> None: @@ -120,7 +120,7 @@ def test_array_info_complete( Serializer : BytesCodec(endian=) Compressors : () No. bytes : {count_bytes} ({count_bytes_formatted}) - No. bytes stored : {count_bytes_stored_formatted} + No. bytes stored : {count_bytes_stored} ({count_bytes_stored_formatted}) Storage ratio : {storage_ratio_formatted} Chunks Initialized : 5""") From 1e7782733d80bff7bca0fd21c379501ff46979d4 Mon Sep 17 00:00:00 2001 From: Julia Signell Date: Tue, 1 Jul 2025 11:09:54 -0400 Subject: [PATCH 2/3] Fix docs for `info_complete` change --- docs/user-guide/arrays.rst | 9 ++++++--- docs/user-guide/groups.rst | 2 +- docs/user-guide/performance.rst | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/user-guide/arrays.rst b/docs/user-guide/arrays.rst index c27f1296b9..6a7dcaf69d 100644 --- a/docs/user-guide/arrays.rst +++ b/docs/user-guide/arrays.rst @@ -211,7 +211,7 @@ prints additional diagnostics, e.g.:: Serializer : BytesCodec(endian=) Compressors : (BloscCodec(typesize=4, cname=, clevel=3, shuffle=, blocksize=0),) No. bytes : 400000000 (381.5M) - No. bytes stored : 3558573 + No. bytes stored : 3558573 (3.4M) Storage ratio : 112.4 Chunks Initialized : 100 @@ -285,7 +285,7 @@ Here is an example using a delta filter with the Blosc compressor:: >>> compressors = zarr.codecs.BloscCodec(cname='zstd', clevel=1, shuffle=zarr.codecs.BloscShuffle.shuffle) >>> data = np.arange(100000000, dtype='int32').reshape(10000, 10000) >>> z = zarr.create_array(store='data/example-9.zarr', shape=data.shape, dtype=data.dtype, chunks=(1000, 1000), filters=filters, compressors=compressors) - >>> z.info + >>> z.info_complete() Type : Array Zarr format : 3 Data type : Int32(endianness='little') @@ -299,6 +299,9 @@ Here is an example using a delta filter with the Blosc compressor:: Serializer : BytesCodec(endian=) Compressors : (BloscCodec(typesize=4, cname=, clevel=1, shuffle=, blocksize=0),) No. bytes : 400000000 (381.5M) + No. bytes stored : 826 + Storage ratio : 484261.5 + Chunks Initialized : 0 For more information about available filter codecs, see the `Numcodecs `_ documentation. @@ -615,7 +618,7 @@ Sharded arrays can be created by providing the ``shards`` parameter to :func:`za Serializer : BytesCodec(endian=None) Compressors : (ZstdCodec(level=0, checksum=False),) No. bytes : 100000000 (95.4M) - No. bytes stored : 3981473 + No. bytes stored : 3981473 (3.8M) Storage ratio : 25.1 Shards Initialized : 100 diff --git a/docs/user-guide/groups.rst b/docs/user-guide/groups.rst index 4237a9df50..a343c3617e 100644 --- a/docs/user-guide/groups.rst +++ b/docs/user-guide/groups.rst @@ -139,7 +139,7 @@ property. E.g.:: Serializer : BytesCodec(endian=) Compressors : (ZstdCodec(level=0, checksum=False),) No. bytes : 8000000 (7.6M) - No. bytes stored : 1614 + No. bytes stored : 1614 (1.6K) Storage ratio : 4956.6 Chunks Initialized : 10 >>> baz.info diff --git a/docs/user-guide/performance.rst b/docs/user-guide/performance.rst index 7d24c87373..0f31e5d7be 100644 --- a/docs/user-guide/performance.rst +++ b/docs/user-guide/performance.rst @@ -133,7 +133,7 @@ ratios, depending on the correlation structure within the data. E.g.:: Serializer : BytesCodec(endian=) Compressors : (ZstdCodec(level=0, checksum=False),) No. bytes : 400000000 (381.5M) - No. bytes stored : 342588911 + No. bytes stored : 342588911 (326.7M) Storage ratio : 1.2 Chunks Initialized : 100 >>> with zarr.config.set({'array.order': 'F'}): @@ -153,7 +153,7 @@ ratios, depending on the correlation structure within the data. E.g.:: Serializer : BytesCodec(endian=) Compressors : (ZstdCodec(level=0, checksum=False),) No. bytes : 400000000 (381.5M) - No. bytes stored : 342588911 + No. bytes stored : 342588911 (326.7M) Storage ratio : 1.2 Chunks Initialized : 100 From e68cfc90a46e4ad42deac282b9c483700dd8d7c9 Mon Sep 17 00:00:00 2001 From: Julia Signell Date: Mon, 7 Jul 2025 10:30:29 -0400 Subject: [PATCH 3/3] Update changelog --- changes/3190.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/3190.bugfix.rst diff --git a/changes/3190.bugfix.rst b/changes/3190.bugfix.rst new file mode 100644 index 0000000000..4e948188e3 --- /dev/null +++ b/changes/3190.bugfix.rst @@ -0,0 +1 @@ +Add human readable size for No. bytes stored to `info_complete` \ No newline at end of file