File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -977,9 +977,16 @@ def _iter_chunk_regions(
977977 @property
978978 def nbytes (self ) -> int :
979979 """
980- The number of bytes that can be stored in the chunks of this array.
980+ The total number of bytes that can be stored in the chunks of this array.
981+
982+ Notes
983+ -----
984+ This value is calculated by multiplying the number of elements in the array and the size
985+ of each element, the latter of which is determined by the dtype of the array.
986+ For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length
987+ dtypes. It is not possible to determine the size of an array with variable-length elements
988+ from the shape and dtype alone.
981989 """
982- # TODO: how can this be meaningful for variable-length types?
983990 return self .size * self .dtype .itemsize
984991
985992 async def _get_selection (
@@ -1741,7 +1748,15 @@ def _iter_chunk_coords(
17411748 @property
17421749 def nbytes (self ) -> int :
17431750 """
1744- The number of bytes that can be stored in this array.
1751+ The total number of bytes that can be stored in the chunks of this array.
1752+
1753+ Notes
1754+ -----
1755+ This value is calculated by multiplying the number of elements in the array and the size
1756+ of each element, the latter of which is determined by the dtype of the array.
1757+ For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length
1758+ dtypes. It is not possible to determine the size of an array with variable-length elements
1759+ from the shape and dtype alone.
17451760 """
17461761 return self ._async_array .nbytes
17471762
You can’t perform that action at this time.
0 commit comments