(self, dim, count)
| 1344 | return type(self)(self.dims, array, attrs=attrs) |
| 1345 | |
| 1346 | def _roll_one_dim(self, dim, count): |
| 1347 | axis = self.get_axis_num(dim) |
| 1348 | |
| 1349 | count %= self.shape[axis] |
| 1350 | if count != 0: |
| 1351 | indices = [slice(-count, None), slice(None, -count)] |
| 1352 | else: |
| 1353 | indices = [slice(None)] |
| 1354 | |
| 1355 | arrays = [self[(slice(None),) * axis + (idx,)].data for idx in indices] |
| 1356 | |
| 1357 | data = duck_array_ops.concatenate(arrays, axis) |
| 1358 | |
| 1359 | if is_duck_dask_array(data): |
| 1360 | # chunked data should come out with the same chunks; this makes |
| 1361 | # it feasible to combine shifted and unshifted data |
| 1362 | # TODO: remove this once dask.array automatically aligns chunks |
| 1363 | data = data.rechunk(self.data.chunks) |
| 1364 | |
| 1365 | return self._replace(data=data) |
| 1366 | |
| 1367 | def roll(self, shifts=None, **shifts_kwargs): |
| 1368 | """ |
no test coverage detected