Skip to content

Commit bb20c41

Browse files
committed
enable data checker for batched deserialized data
1 parent 53f1341 commit bb20c41

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

xarray/backends/pydap_.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,17 @@ def _getitem(self, key):
5757
if self._batch and hasattr(self.array, "dataset"):
5858
# this are both True only for pydap>3.5.5
5959
# 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
6161

6262
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)
7165
else:
72-
print("[non-batching]", self.array.id)
7366
result = robust_getitem(self.array, key, catch=ValueError)
7467
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)
8571
return result
8672

8773

0 commit comments

Comments
 (0)