Skip to content

Commit 28d201f

Browse files
author
Martin Durant
committed
Add notes
1 parent 27117b7 commit 28d201f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zarr/core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,12 +1022,14 @@ def _get_selection(self, indexer, out=None, fields=None):
10221022

10231023
# iterate over chunks
10241024
if not hasattr(self.store, "getitems"):
1025+
# sequentially get one key at a time from storage
10251026
for chunk_coords, chunk_selection, out_selection in indexer:
10261027

10271028
# load chunk selection into output array
10281029
self._chunk_getitem(chunk_coords, chunk_selection, out, out_selection,
10291030
drop_axes=indexer.drop_axes, fields=fields)
10301031
else:
1032+
# allow storage to get multiple items at once
10311033
lchunk_coords, lchunk_selection, lout_selection = zip(*indexer)
10321034
self._chunk_getitems(lchunk_coords, lchunk_selection, out, lout_selection,
10331035
drop_axes=indexer.drop_axes, fields=fields)
@@ -1556,6 +1558,7 @@ def _set_selection(self, indexer, value, fields=None):
15561558

15571559
def _process_chunk(self, out, cdata, chunk_selection, drop_axes,
15581560
out_is_ndarray, fields, out_selection):
1561+
"""Take binary data from storage and fill output array"""
15591562
if (out_is_ndarray and
15601563
not fields and
15611564
is_contiguous_selection(out_selection) and
@@ -1649,6 +1652,11 @@ def _chunk_getitem(self, chunk_coords, chunk_selection, out, out_selection,
16491652

16501653
def _chunk_getitems(self, lchunk_coords, lchunk_selection, out, lout_selection,
16511654
drop_axes=None, fields=None):
1655+
"""As _chunk_getitem, but for lists of chunks
1656+
1657+
This gets called where the storage supports ``getitems``, so that
1658+
it can decide how to fetch the keys, allowing concurrency.
1659+
"""
16521660
out_is_ndarray = True
16531661
try:
16541662
out = ensure_ndarray(out)

0 commit comments

Comments
 (0)