xdas.coordinates.InterpCoordinate.format_index#

InterpCoordinate.format_index(idx, bounds='raise')#

Normalise integer index idx, handling negative indices and optional bounds checking.

Parameters:
  • idx (int or array-like of int) – Index or indices to normalise.

  • bounds ({"raise", "clip"}, optional) – "raise" (default) raises IndexError for out-of-bounds indices; "clip" clamps them to the valid range.

Returns:

Non-negative integer index array.

Return type:

numpy.ndarray