MCPcopy Create free account
hub / github.com/pydata/xarray / _posify_indices

Function _posify_indices

xarray/core/indexing.py:1466–1472  ·  view source on GitHub ↗

Convert negative indices by their equivalent positive indices. Note: the resulting indices may still be out of bounds (< 0 or >= size).

(indices: Any, size: int)

Source from the content-addressed store, hash-verified

1464
1465
1466def _posify_indices(indices: Any, size: int) -> np.ndarray:
1467 """Convert negative indices by their equivalent positive indices.
1468
1469 Note: the resulting indices may still be out of bounds (< 0 or >= size).
1470
1471 """
1472 return np.where(indices < 0, size + indices, indices)
1473
1474
1475def _check_bounds(indices: Any, size: int):

Callers 2

_arrayize_outer_indexerFunction · 0.85
_vindex_getMethod · 0.85

Calls 1

whereMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…