MCPcopy Index your code
hub / github.com/pydata/xarray / roll

Method roll

xarray/core/variable.py:1367–1391  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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(

Callers 2

test_rollMethod · 0.95
test_roll_consistencyMethod · 0.95

Calls 3

either_dict_or_kwargsFunction · 0.90
itemsMethod · 0.80
_roll_one_dimMethod · 0.80

Tested by 2

test_rollMethod · 0.76
test_roll_consistencyMethod · 0.76