pyinterp.Axis.find_index#
- Axis.find_index(self, coordinates: numpy.ndarray[dtype=float64, shape=(*), writable=False], bounded: bool = True) numpy.ndarray[dtype=int64, shape=(*), order='C']#
Find the index of the axis element that contains a coordinate.
Search the axis for the grid index that contains each provided coordinate. If a coordinate lies outside the axis range, behavior depends on the ‘bounded’ argument.
- Parameters:
coordinates – Positions in this coordinate system.
bounded – If True, coordinates outside the axis range yield -1. If False, the index of the closest axis value is returned.
- Returns:
Index of the grid point containing the coordinate, or -1 for out-of-range coordinates when bounded is True.