stilt.flux.nearest_cell#

stilt.flux.nearest_cell(coords, values)[source]#

Return the index of the cell nearest each value, or -1 outside the cells.

Each cell reaches halfway to its neighbours. The end cells reach the same distance beyond their centres. With a single cell, every finite value is inside it.

Parameters:
  • coords (ndarray) – Cell centres along one axis, ascending or descending.

  • values (ndarray) – Positions to look up.

Returns:

Index into coords for each value.

Return type:

ndarray