@@ -57,31 +57,17 @@ def _getitem(self, key):
57
57
if self ._batch and hasattr (self .array , "dataset" ):
58
58
# this are both True only for pydap>3.5.5
59
59
# from pydap.lib import resolve_batch_for_all_variables
60
- from pydap .lib import get_batch_data
60
+ from pydap .lib import data_check , get_batch_data
61
61
62
62
dataset = self .array .dataset
63
- print ("[batching]" , self .array .id )
64
- if not dataset [self .array .id ]._is_data_loaded ():
65
- print ("data not loaded" , self .array .id )
66
- # data has not been deserialized yet
67
- # runs only once per store/hierarchy
68
- get_batch_data (self .array , checksums = self ._checksums , key = key )
69
- result = np .asarray (dataset [self .array .id ].data )
70
- result = robust_getitem (result , key , catch = ValueError )
63
+ get_batch_data (self .array , checksums = self ._checksums , key = key )
64
+ result = data_check (np .asarray (dataset [self .array .id ].data ), key )
71
65
else :
72
- print ("[non-batching]" , self .array .id )
73
66
result = robust_getitem (self .array , key , catch = ValueError )
74
67
result = np .asarray (result .data )
75
- axis = tuple (n for n , k in enumerate (key ) if isinstance (k , integer_types ))
76
- print (key )
77
- print ("axis:" , axis )
78
- # print("ndim", result.ndim)
79
- # print("array.ndim", self.array.ndim)
80
- if result .ndim + len (axis ) != self .array .ndim and axis :
81
- # print('here????')
82
- # print("squeezed result", np.shape(result))
83
- result = np .squeeze (result , axis )
84
- # print("squeezed result", np.shape(result))
68
+ axis = tuple (n for n , k in enumerate (key ) if isinstance (k , integer_types ))
69
+ if result .ndim + len (axis ) != self .array .ndim and axis :
70
+ result = np .squeeze (result , axis )
85
71
return result
86
72
87
73
0 commit comments