@@ -999,9 +999,17 @@ def _iter_chunk_regions(
999999 @property
10001000 def nbytes (self ) -> int :
10011001 """
1002- The number of bytes that can be stored in this array.
1002+ The total number of bytes that can be stored in the chunks of this array.
1003+
1004+ Notes
1005+ -----
1006+ This value is calculated by multiplying the number of elements in the array and the size
1007+ of each element, the latter of which is determined by the dtype of the array.
1008+ For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length
1009+ dtypes. It is not possible to determine the size of an array with variable-length elements
1010+ from the shape and dtype alone.
10031011 """
1004- return self .nchunks * self .dtype .itemsize
1012+ return self .size * self .dtype .itemsize
10051013
10061014 async def _get_selection (
10071015 self ,
@@ -1451,7 +1459,7 @@ def _info(
14511459 _order = self .order ,
14521460 _read_only = self .read_only ,
14531461 _store_type = type (self .store_path .store ).__name__ ,
1454- _count_bytes = self .dtype . itemsize * self . size ,
1462+ _count_bytes = self .nbytes ,
14551463 _count_bytes_stored = count_bytes_stored ,
14561464 _count_chunks_initialized = count_chunks_initialized ,
14571465 ** kwargs ,
@@ -1792,7 +1800,15 @@ def _iter_chunk_coords(
17921800 @property
17931801 def nbytes (self ) -> int :
17941802 """
1795- The number of bytes that can be stored in this array.
1803+ The total number of bytes that can be stored in the chunks of this array.
1804+
1805+ Notes
1806+ -----
1807+ This value is calculated by multiplying the number of elements in the array and the size
1808+ of each element, the latter of which is determined by the dtype of the array.
1809+ For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length
1810+ dtypes. It is not possible to determine the size of an array with variable-length elements
1811+ from the shape and dtype alone.
17961812 """
17971813 return self ._async_array .nbytes
17981814
0 commit comments