@@ -678,7 +678,9 @@ async def async_get_duck_array(self):
678
678
# and self.key is BasicIndexer((slice(None, None, None),))
679
679
# so we need the explicit check for ExplicitlyIndexed
680
680
if isinstance (array , ExplicitlyIndexed ):
681
- array = await array .async_get_duck_array ()
681
+ # At this point, we have issued completed the possible async load from disk
682
+ # and array is in-memory. So use the sync get
683
+ array = array .get_duck_array ()
682
684
return _wrap_numpy_scalars (array )
683
685
684
686
def transpose (self , order ):
@@ -769,7 +771,9 @@ async def async_get_duck_array(self):
769
771
# and self.key is BasicIndexer((slice(None, None, None),))
770
772
# so we need the explicit check for ExplicitlyIndexed
771
773
if isinstance (array , ExplicitlyIndexed ):
772
- array = await array .async_get_duck_array ()
774
+ # At this point, we have issued completed the possible async load from disk
775
+ # and array is in-memory. So use the sync get
776
+ array = array .get_duck_array ()
773
777
return _wrap_numpy_scalars (array )
774
778
775
779
def _updated_key (self , new_key : ExplicitIndexer ):
@@ -877,15 +881,16 @@ def __init__(self, array):
877
881
self .array = _wrap_numpy_scalars (as_indexable (array ))
878
882
879
883
def get_duck_array (self ):
880
- # first ensure the array object is cached
881
- self .array = as_indexable (self .array .get_duck_array ())
882
- return self .array .get_duck_array ()
884
+ duck_array = self .array .get_duck_array ()
885
+ # ensure the array object is cached in-memory
886
+ self .array = as_indexable (duck_array )
887
+ return duck_array
883
888
884
889
async def async_get_duck_array (self ):
885
- # first ensure the array object is cached
886
890
duck_array = await self .array .async_get_duck_array ()
891
+ # ensure the array object is cached in-memory
887
892
self .array = as_indexable (duck_array )
888
- return await self . array . async_get_duck_array ()
893
+ return duck_array
889
894
890
895
def _oindex_get (self , indexer : OuterIndexer ):
891
896
return type (self )(_wrap_numpy_scalars (self .array .oindex [indexer ]))
@@ -1620,16 +1625,6 @@ def __getitem__(self, indexer: ExplicitIndexer):
1620
1625
key = indexer .tuple + (Ellipsis ,)
1621
1626
return array [key ]
1622
1627
1623
- async def async_getitem (self , indexer : ExplicitIndexer ):
1624
- self ._check_and_raise_if_non_basic_indexer (indexer )
1625
-
1626
- array = self .array
1627
- # We want 0d slices rather than scalars. This is achieved by
1628
- # appending an ellipsis (see
1629
- # https://numpy.org/doc/stable/reference/arrays.indexing.html#detailed-notes).
1630
- key = indexer .tuple + (Ellipsis ,)
1631
- return array [key ]
1632
-
1633
1628
def _safe_setitem (self , array , key : tuple [Any , ...], value : Any ) -> None :
1634
1629
try :
1635
1630
array [key ] = value
0 commit comments