Return a new Variable with rolled data. Parameters ---------- shifts : mapping of hashable to int Integer offset to roll along each of the given dimensions. Positive offsets roll to the right; negative offsets roll to the left.
(self, shifts=None, **shifts_kwargs)
| 1365 | return self._replace(data=data) |
| 1366 | |
| 1367 | def roll(self, shifts=None, **shifts_kwargs): |
| 1368 | """ |
| 1369 | Return a new Variable with rolled data. |
| 1370 | |
| 1371 | Parameters |
| 1372 | ---------- |
| 1373 | shifts : mapping of hashable to int |
| 1374 | Integer offset to roll along each of the given dimensions. |
| 1375 | Positive offsets roll to the right; negative offsets roll to the |
| 1376 | left. |
| 1377 | **shifts_kwargs |
| 1378 | The keyword arguments form of ``shifts``. |
| 1379 | One of shifts or shifts_kwargs must be provided. |
| 1380 | |
| 1381 | Returns |
| 1382 | ------- |
| 1383 | shifted : Variable |
| 1384 | Variable with the same dimensions and attributes but rolled data. |
| 1385 | """ |
| 1386 | shifts = either_dict_or_kwargs(shifts, shifts_kwargs, "roll") |
| 1387 | |
| 1388 | result = self |
| 1389 | for dim, count in shifts.items(): |
| 1390 | result = result._roll_one_dim(dim, count) |
| 1391 | return result |
| 1392 | |
| 1393 | @deprecate_dims |
| 1394 | def transpose( |