MCPcopy
hub / github.com/pydata/xarray / _query_slice

Function _query_slice

xarray/core/indexes.py:572–590  ·  view source on GitHub ↗
(index, label, coord_name="", method=None, tolerance=None)

Source from the content-addressed store, hash-verified

570
571
572def _query_slice(index, label, coord_name="", method=None, tolerance=None):
573 if method is not None or tolerance is not None:
574 raise NotImplementedError(
575 "cannot use ``method`` argument if any indexers are slice objects"
576 )
577 indexer = index.slice_indexer(
578 _sanitize_slice_element(label.start),
579 _sanitize_slice_element(label.stop),
580 _sanitize_slice_element(label.step),
581 )
582 if not isinstance(indexer, slice):
583 # unlike pandas, in xarray we never want to silently convert a
584 # slice indexer into an array indexer
585 raise KeyError(
586 "cannot represent labeled-based slice indexer for coordinate "
587 f"{coord_name!r} with a slice over integer positions; the index is "
588 "unsorted or non-unique"
589 )
590 return indexer
591
592
593def _asarray_tuplesafe(values):

Callers 2

selMethod · 0.85
selMethod · 0.85

Calls 1

_sanitize_slice_elementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…