docs: def get_clean_interp_index(arr, dim, use_coordinate=True, **kwargs):
      '''get index to use for x values in interpolation.
  
      If use_coordinate is True, the coordinate that shares the name of the
      dimension along which interpolation is being performed will be used as the
      x values.
  
      If use_coordinate is False, the x values are set as an equally spaced
      sequence.
      '''
      if use_coordinate:
          if use_coordinate is True:
              index = arr.get_index(dim)
          else:
              index = arr.coords[use_coordinate]
              if index.ndim != 1:
                  raise ValueError(
                      'Coordinates used for interpolation must be 1D, '
                      '%s is %dD.' % (use_coordinate, index.ndim))
  
          # raise if index cannot be cast to a float (e.g. MultiIndex)
          try:
              index = index.values.astype(np.float64)
          except (TypeError, ValueError):
              # pandas raises a TypeError
              # xarray/nuppy raise a ValueError
              raise TypeError('Index must be castable to float64 to support'
                              'interpolation, got: %s' % type(index))
          # check index sorting now so we can skip it later
          if not (np.diff(index) > 0).all():
              raise ValueError("Index must be monotonicly increasing")
      else:
          axis = arr.get_axis_num(dim)
          index = np.arange(arr.shape[axis], dtype=np.float64)
  
      return index