@@ -1021,11 +1021,16 @@ def _get_selection(self, indexer, out=None, fields=None):
1021
1021
check_array_shape ('out' , out , out_shape )
1022
1022
1023
1023
# iterate over chunks
1024
- for chunk_coords , chunk_selection , out_selection in indexer :
1024
+ if not hasattr (self .store , "getitems" ):
1025
+ for chunk_coords , chunk_selection , out_selection in indexer :
1025
1026
1026
- # load chunk selection into output array
1027
- self ._chunk_getitem (chunk_coords , chunk_selection , out , out_selection ,
1028
- drop_axes = indexer .drop_axes , fields = fields )
1027
+ # load chunk selection into output array
1028
+ self ._chunk_getitem (chunk_coords , chunk_selection , out , out_selection ,
1029
+ drop_axes = indexer .drop_axes , fields = fields )
1030
+ else :
1031
+ lchunk_coords , lchunk_selection , lout_selection = zip (* indexer )
1032
+ self ._chunk_getitems (lchunk_coords , lchunk_selection , out , lout_selection ,
1033
+ drop_axes = indexer .drop_axes , fields = fields )
1029
1034
1030
1035
if out .shape :
1031
1036
return out
@@ -1550,7 +1555,7 @@ def _set_selection(self, indexer, value, fields=None):
1550
1555
self ._chunk_setitem (chunk_coords , chunk_selection , chunk_value , fields = fields )
1551
1556
1552
1557
def _process_chunk (self , out , cdata , chunk_selection , drop_axes ,
1553
- out_is_ndarray ):
1558
+ out_is_ndarray , fields , out_selection ):
1554
1559
if (out_is_ndarray and
1555
1560
not fields and
1556
1561
is_contiguous_selection (out_selection ) and
@@ -1614,6 +1619,11 @@ def _chunk_getitem(self, chunk_coords, chunk_selection, out, out_selection,
1614
1619
TODO
1615
1620
1616
1621
"""
1622
+ out_is_ndarray = True
1623
+ try :
1624
+ out = ensure_ndarray (out )
1625
+ except TypeError :
1626
+ out_is_ndarray = False
1617
1627
1618
1628
assert len (chunk_coords ) == len (self ._cdata_shape )
1619
1629
@@ -1635,7 +1645,7 @@ def _chunk_getitem(self, chunk_coords, chunk_selection, out, out_selection,
1635
1645
1636
1646
else :
1637
1647
self ._process_chunk (out , cdata , chunk_selection , drop_axes ,
1638
- out_is_ndarray )
1648
+ out_is_ndarray , fields , out_selection )
1639
1649
1640
1650
def _chunk_getitems (self , lchunk_coords , lchunk_selection , out , lout_selection ,
1641
1651
drop_axes = None , fields = None ):
@@ -1650,7 +1660,7 @@ def _chunk_getitems(self, lchunk_coords, lchunk_selection, out, lout_selection,
1650
1660
for ckey , chunk_select , out_select in zip (ckeys , lchunk_selection , lout_selection ):
1651
1661
if ckey in cdatas :
1652
1662
self ._process_chunk (out , cdatas [ckey ], chunk_select , drop_axes ,
1653
- out_is_ndarray )
1663
+ out_is_ndarray , fields , out_select )
1654
1664
else :
1655
1665
# check exception type
1656
1666
if self ._fill_value is not None :
0 commit comments