Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/3081.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds ``fill_value`` to the list of attributes displayed in the output of the ``AsyncArray.info()`` method.
8 changes: 6 additions & 2 deletions docs/user-guide/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ which can be used to print useful diagnostics, e.g.::
Type : Array
Zarr format : 3
Data type : DataType.int32
Fill value : 0
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Order : C
Expand All @@ -200,6 +201,7 @@ prints additional diagnostics, e.g.::
Type : Array
Zarr format : 3
Data type : DataType.int32
Fill value : 0
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Order : C
Expand All @@ -209,8 +211,8 @@ prints additional diagnostics, e.g.::
Serializer : BytesCodec(endian=<Endian.little: 'little'>)
Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
No. bytes : 400000000 (381.5M)
No. bytes stored : 3558573
Storage ratio : 112.4
No. bytes stored : 9696520
Storage ratio : 41.3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks off-target from my PR, curious how this change slipped in

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing the same thing in my PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is possibly because of the yanked numcodecs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I was unaware numcodecs had been yanked, ok that's probably it then.

Chunks Initialized : 100

.. note::
Expand Down Expand Up @@ -287,6 +289,7 @@ Here is an example using a delta filter with the Blosc compressor::
Type : Array
Zarr format : 3
Data type : DataType.int32
Fill value : 0
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Order : C
Expand Down Expand Up @@ -601,6 +604,7 @@ Sharded arrays can be created by providing the ``shards`` parameter to :func:`za
Type : Array
Zarr format : 3
Data type : DataType.uint8
Fill value : 0
Shape : (10000, 10000)
Shard shape : (1000, 1000)
Chunk shape : (100, 100)
Expand Down
2 changes: 2 additions & 0 deletions docs/user-guide/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ property. E.g.::
Type : Array
Zarr format : 3
Data type : DataType.int64
Fill value : 0
Shape : (1000000,)
Chunk shape : (100000,)
Order : C
Expand All @@ -145,6 +146,7 @@ property. E.g.::
Type : Array
Zarr format : 3
Data type : DataType.float32
Fill value : 0.0
Shape : (1000, 1000)
Chunk shape : (100, 100)
Order : C
Expand Down
3 changes: 3 additions & 0 deletions docs/user-guide/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ To use sharding, you need to specify the ``shards`` parameter when creating the
Type : Array
Zarr format : 3
Data type : DataType.uint8
Fill value : 0
Shape : (10000, 10000, 1000)
Shard shape : (1000, 1000, 1000)
Chunk shape : (100, 100, 100)
Expand Down Expand Up @@ -122,6 +123,7 @@ ratios, depending on the correlation structure within the data. E.g.::
Type : Array
Zarr format : 3
Data type : DataType.int32
Fill value : 0
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Order : C
Expand All @@ -141,6 +143,7 @@ ratios, depending on the correlation structure within the data. E.g.::
Type : Array
Zarr format : 3
Data type : DataType.int32
Fill value : 0
Shape : (10000, 10000)
Chunk shape : (1000, 1000)
Order : F
Expand Down
4 changes: 3 additions & 1 deletion src/zarr/core/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def byte_info(size: int) -> str:
return f"{size} ({human_readable_size(size)})"


@dataclasses.dataclass(kw_only=True)
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
class ArrayInfo:
"""
Visual summary for an Array.
Expand All @@ -79,6 +79,7 @@ class ArrayInfo:
_type: Literal["Array"] = "Array"
_zarr_format: ZarrFormat
_data_type: np.dtype[Any] | DataType
_fill_value: object
_shape: tuple[int, ...]
_shard_shape: tuple[int, ...] | None = None
_chunk_shape: tuple[int, ...] | None = None
Expand All @@ -97,6 +98,7 @@ def __repr__(self) -> str:
Type : {_type}
Zarr format : {_zarr_format}
Data type : {_data_type}
Fill value : {_fill_value}
Shape : {_shape}""")

if self._shard_shape is not None:
Expand Down
1 change: 1 addition & 0 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,7 @@ def _info(
return ArrayInfo(
_zarr_format=self.metadata.zarr_format,
_data_type=_data_type,
_fill_value=self.metadata.fill_value,
_shape=self.shape,
_order=self.order,
_shard_shape=self.shards,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ def test_info_v2(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
expected = ArrayInfo(
_zarr_format=2,
_data_type=np.dtype("float64"),
_fill_value=arr.fill_value,
_shape=(8, 8),
_chunk_shape=chunks,
_shard_shape=None,
Expand All @@ -539,6 +540,7 @@ def test_info_v3(self, chunks: tuple[int, int], shards: tuple[int, int] | None)
expected = ArrayInfo(
_zarr_format=3,
_data_type=DataType.parse("float64"),
_fill_value=arr.fill_value,
_shape=(8, 8),
_chunk_shape=chunks,
_shard_shape=shards,
Expand All @@ -564,6 +566,7 @@ def test_info_complete(self, chunks: tuple[int, int], shards: tuple[int, int] |
expected = ArrayInfo(
_zarr_format=3,
_data_type=DataType.parse("float64"),
_fill_value=arr.fill_value,
_shape=(8, 8),
_chunk_shape=chunks,
_shard_shape=shards,
Expand Down Expand Up @@ -599,6 +602,7 @@ async def test_info_v2_async(
expected = ArrayInfo(
_zarr_format=2,
_data_type=np.dtype("float64"),
_fill_value=arr.metadata.fill_value,
_shape=(8, 8),
_chunk_shape=(2, 2),
_shard_shape=None,
Expand All @@ -624,6 +628,7 @@ async def test_info_v3_async(
expected = ArrayInfo(
_zarr_format=3,
_data_type=DataType.parse("float64"),
_fill_value=arr.metadata.fill_value,
_shape=(8, 8),
_chunk_shape=chunks,
_shard_shape=shards,
Expand Down Expand Up @@ -651,6 +656,7 @@ async def test_info_complete_async(
expected = ArrayInfo(
_zarr_format=3,
_data_type=DataType.parse("float64"),
_fill_value=arr.metadata.fill_value,
_shape=(8, 8),
_chunk_shape=chunks,
_shard_shape=shards,
Expand Down
4 changes: 4 additions & 0 deletions tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def test_array_info(zarr_format: ZarrFormat) -> None:
info = ArrayInfo(
_zarr_format=zarr_format,
_data_type=np.dtype("int32"),
_fill_value=0,
_shape=(100, 100),
_chunk_shape=(10, 100),
_order="C",
Expand All @@ -66,6 +67,7 @@ def test_array_info(zarr_format: ZarrFormat) -> None:
Type : Array
Zarr format : {zarr_format}
Data type : int32
Fill value : 0
Shape : (100, 100)
Chunk shape : (10, 100)
Order : C
Expand All @@ -92,6 +94,7 @@ def test_array_info_complete(
info = ArrayInfo(
_zarr_format=zarr_format,
_data_type=np.dtype("int32"),
_fill_value=0,
_shape=(100, 100),
_chunk_shape=(10, 100),
_order="C",
Expand All @@ -107,6 +110,7 @@ def test_array_info_complete(
Type : Array
Zarr format : {zarr_format}
Data type : int32
Fill value : 0
Shape : (100, 100)
Chunk shape : (10, 100)
Order : C
Expand Down
Loading