| 36 | |
| 37 | |
| 38 | class PydapArrayWrapper(BackendArray): |
| 39 | def __init__(self, array, checksums=True): |
| 40 | self.array = array |
| 41 | |
| 42 | @property |
| 43 | def shape(self) -> tuple[int, ...]: |
| 44 | return self.array.shape |
| 45 | |
| 46 | @property |
| 47 | def dtype(self): |
| 48 | return self.array.dtype |
| 49 | |
| 50 | def __getitem__(self, key): |
| 51 | return indexing.explicit_indexing_adapter( |
| 52 | key, self.shape, indexing.IndexingSupport.BASIC, self._getitem |
| 53 | ) |
| 54 | |
| 55 | def _getitem(self, key): |
| 56 | result = robust_getitem(self.array, key, catch=ValueError) |
| 57 | result = np.asarray(result.data) |
| 58 | axis = tuple(n for n, k in enumerate(key) if isinstance(k, integer_types)) |
| 59 | if result.ndim + len(axis) != self.array.ndim and axis: |
| 60 | result = np.squeeze(result, axis) |
| 61 | return result |
| 62 | |
| 63 | |
| 64 | def get_group(ds, group): |
no outgoing calls
no test coverage detected
searching dependent graphs…