interp (pyleoclim.utils.tsutils.interp)

pyleoclim.utils.tsutils.interp(x, y, interp_type='linear', step=None, start=None, stop=None, step_style='mean', **kwargs)[source]

Interpolate y onto a new x-axis

Parameters
  • x (array) – The x-axis

  • y (array) – The y-axis

  • interp_type ({‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’}) – where ‘zero’, ‘slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of zeroth, first, second or third order; ‘previous’ and ‘next’ simply return the previous or next value of the point) or as an integer specifying the order of the spline interpolator to use. Default is ‘linear’.

  • step (float) – The interpolation step. Default is mean spacing between consecutive points.

  • start (float) – where/when to start the interpolation. Default is min..

  • stop (float) – where/when to stop the interpolation. Default is max.

  • kwargs (kwargs) – Aguments specific to interpolate.interp1D. See scipy for details https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html If getting an error about extrapolation, you can use the arguments bound_errors=False and fill_value=”extrapolate” to allow for extrapolation.

Returns

  • xi (array) – The interpolated x-axis

  • yi (array) – The interpolated y values