Skip to content

Commit

Permalink
use nbytes in array info construction
Browse files Browse the repository at this point in the history
  • Loading branch information
d-v-b committed Dec 19, 2024
1 parent 9e8f351 commit 378cbaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ def nbytes(self) -> int:
The number of bytes that can be stored in the chunks of this array.
"""
# TODO: how can this be meaningful for variable-length types?
return int(np.prod(self.shape) * self.dtype.itemsize)
return self.size * self.dtype.itemsize

async def _get_selection(
self,
Expand Down Expand Up @@ -1430,7 +1430,7 @@ def _info(
_order=self.order,
_read_only=self.read_only,
_store_type=type(self.store_path.store).__name__,
_count_bytes=self.dtype.itemsize * self.size,
_count_bytes=self.nbytes,
_count_bytes_stored=count_bytes_stored,
_count_chunks_initialized=count_chunks_initialized,
**kwargs,
Expand Down

0 comments on commit 378cbaf

Please sign in to comment.