obspy/obspy — pull request #821 by krischer (2014-06-12 14:01:20+00:00)
Title: Interpolating

New `interpolate()` method for `Stream` and `Trace` objects. No filtering or other processing is performed so users really need to know what they are doing but it is useful for some use cases.

The default interpolation method uses an weighted average slopes scheme which is the same `SAC` uses. This is fairly well justified as this method guarantees that there will be no additional extrema in the interpolated waveform. This is in contrast to normal spline interpolation which this method also supports. All new samples will be contained in the old time range - no extrapolation is performed.

### Usage

```
# Interpolate all traces to a new sampling rate.
st.interpolate(sampling_rate=2.0)

# One can also set a new starttime.
tr.interpolate(sampling_rate=2.0, starttime=tr.stats.starttime + 10)

# Or the number of samples
tr.interpolate(sampling_rate=2.0, npts=200)

# Different methods are supported. The weighted average slope method is the one used by sac and is
# the default.
st.interpolate(sampling_rate=2.0, method="weighted_average_slopes")
st.interpolate(sampling_rate=2.0, method="weighted_average_slopes")
st.interpolate(sampling_rate=2.0, method="weighted_average_slopes")