File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 18
18
from .npcompat import DTypeLike
19
19
from .nputils import NumpyVIndexAdapter
20
20
from .options import OPTIONS
21
- from .pycompat import dask_version , integer_types , is_duck_dask_array , sparse_array_type
21
+ from .pycompat import (
22
+ dask_version ,
23
+ integer_types ,
24
+ is_duck_array ,
25
+ is_duck_dask_array ,
26
+ sparse_array_type ,
27
+ )
22
28
from .types import T_Xarray
23
29
from .utils import (
24
30
NDArrayMixin ,
@@ -532,9 +538,11 @@ def get_duck_array(self):
532
538
array = as_indexable (self .array )
533
539
array = array [self .key ]
534
540
if isinstance (array , ExplicitlyIndexed ):
535
- return array .get_duck_array ()
536
- else :
537
- return array
541
+ array = array .get_duck_array ()
542
+ if not is_duck_array (array ):
543
+ # This hack is necessary for 0D netCDF4 variables
544
+ array = np .asarray (array )
545
+ return array
538
546
539
547
def transpose (self , order ):
540
548
return LazilyVectorizedIndexedArray (self .array , self .key ).transpose (order )
You can’t perform that action at this time.
0 commit comments