pyinterp.Axis.find_index

Axis.find_index(self: pyinterp.core.Axis, coordinates: numpy.ndarray[numpy.float64], bounded: bool = False) numpy.ndarray[numpy.int64]

Given coordinate positions, find what grid elements contains them, or is closest to them.

Parameters
  • coordinates (numpy.ndarray) – Positions in this coordinate system.

  • bounded (bool, optional) – True if you want to obtain the closest value to a coordinate outside the axis definition range.

Returns

index of the grid points containing them or -1 if the bounded parameter is set to false and if one of the searched indexes is out of the definition range of the axis, otherwise the index of the closest value of the coordinate is returned.

Return type

numpy.ndarray