1-D linear interpolation with interpolation of hours/longitude
Parameters: | newx : array_like
x : array_like
y : array_like
wrap : string, optional
kwargs : dict
|
---|---|
Returns: | out : numpy.masked_array
|
Examples
For a simple interpolation
>>> import spacepy.toolbox as tb
>>> import numpy
>>> x = numpy.arange(10)
>>> y = numpy.arange(10)
>>> tb.interpol(numpy.arange(5)+0.5, x, y)
array([ 0.5, 1.5, 2.5, 3.5, 4.5])
To use the wrap functionality, without the wrap keyword you get the wrong answer
>>> y = range(24)*2
>>> x = range(len(y))
>>> tb.interpol([1.5, 10.5, 23.5], x, y, wrap='hour').compressed() # compress removed the masked array
array([ 1.5, 10.5, 23.5])
>>> tb.interpol([1.5, 10.5, 23.5], x, y)
array([ 1.5, 10.5, 11.5])