Skip to content

Commit 11065e6

Browse files
committed
add fill_value output to info
1 parent 481550a commit 11065e6

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

changes/xxxx.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds ``fill_value`` to the list of attributes displayed in the output of the ``AsyncArray.info()`` method.

docs/user-guide/arrays.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ which can be used to print useful diagnostics, e.g.::
183183
Type : Array
184184
Zarr format : 3
185185
Data type : DataType.int32
186+
Fill value : 0
186187
Shape : (10000, 10000)
187188
Chunk shape : (1000, 1000)
188189
Order : C
@@ -200,6 +201,7 @@ prints additional diagnostics, e.g.::
200201
Type : Array
201202
Zarr format : 3
202203
Data type : DataType.int32
204+
Fill value : 0
203205
Shape : (10000, 10000)
204206
Chunk shape : (1000, 1000)
205207
Order : C
@@ -209,8 +211,8 @@ prints additional diagnostics, e.g.::
209211
Serializer : BytesCodec(endian=<Endian.little: 'little'>)
210212
Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
211213
No. bytes : 400000000 (381.5M)
212-
No. bytes stored : 3558573
213-
Storage ratio : 112.4
214+
No. bytes stored : 9696520
215+
Storage ratio : 41.3
214216
Chunks Initialized : 100
215217

216218
.. note::
@@ -287,6 +289,7 @@ Here is an example using a delta filter with the Blosc compressor::
287289
Type : Array
288290
Zarr format : 3
289291
Data type : DataType.int32
292+
Fill value : 0
290293
Shape : (10000, 10000)
291294
Chunk shape : (1000, 1000)
292295
Order : C
@@ -601,6 +604,7 @@ Sharded arrays can be created by providing the ``shards`` parameter to :func:`za
601604
Type : Array
602605
Zarr format : 3
603606
Data type : DataType.uint8
607+
Fill value : 0
604608
Shape : (10000, 10000)
605609
Shard shape : (1000, 1000)
606610
Chunk shape : (100, 100)

docs/user-guide/groups.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ property. E.g.::
129129
Type : Array
130130
Zarr format : 3
131131
Data type : DataType.int64
132+
Fill value : 0
132133
Shape : (1000000,)
133134
Chunk shape : (100000,)
134135
Order : C
@@ -145,6 +146,7 @@ property. E.g.::
145146
Type : Array
146147
Zarr format : 3
147148
Data type : DataType.float32
149+
Fill value : 0.0
148150
Shape : (1000, 1000)
149151
Chunk shape : (100, 100)
150152
Order : C

docs/user-guide/performance.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ To use sharding, you need to specify the ``shards`` parameter when creating the
9292
Type : Array
9393
Zarr format : 3
9494
Data type : DataType.uint8
95+
Fill value : 0
9596
Shape : (10000, 10000, 1000)
9697
Shard shape : (1000, 1000, 1000)
9798
Chunk shape : (100, 100, 100)
@@ -122,6 +123,7 @@ ratios, depending on the correlation structure within the data. E.g.::
122123
Type : Array
123124
Zarr format : 3
124125
Data type : DataType.int32
126+
Fill value : 0
125127
Shape : (10000, 10000)
126128
Chunk shape : (1000, 1000)
127129
Order : C
@@ -141,6 +143,7 @@ ratios, depending on the correlation structure within the data. E.g.::
141143
Type : Array
142144
Zarr format : 3
143145
Data type : DataType.int32
146+
Fill value : 0
144147
Shape : (10000, 10000)
145148
Chunk shape : (1000, 1000)
146149
Order : F

src/zarr/core/_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def byte_info(size: int) -> str:
6767
return f"{size} ({human_readable_size(size)})"
6868

6969

70-
@dataclasses.dataclass(kw_only=True)
70+
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
7171
class ArrayInfo:
7272
"""
7373
Visual summary for an Array.
@@ -79,6 +79,7 @@ class ArrayInfo:
7979
_type: Literal["Array"] = "Array"
8080
_zarr_format: ZarrFormat
8181
_data_type: np.dtype[Any] | DataType
82+
_fill_value: object
8283
_shape: tuple[int, ...]
8384
_shard_shape: tuple[int, ...] | None = None
8485
_chunk_shape: tuple[int, ...] | None = None
@@ -97,6 +98,7 @@ def __repr__(self) -> str:
9798
Type : {_type}
9899
Zarr format : {_zarr_format}
99100
Data type : {_data_type}
101+
Fill value : {_fill_value}
100102
Shape : {_shape}""")
101103

102104
if self._shard_shape is not None:

src/zarr/core/array.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,7 @@ def _info(
17021702
return ArrayInfo(
17031703
_zarr_format=self.metadata.zarr_format,
17041704
_data_type=_data_type,
1705+
_fill_value=self.metadata.fill_value,
17051706
_shape=self.shape,
17061707
_order=self.order,
17071708
_shard_shape=self.shards,

0 commit comments

Comments
 (0)