Trimming data

Dear all

I am trying to compute cross-correlation matrix around P arrival times of some events.

When I trim the data around P arrival, some traces have lenght 20 and some 21. How should I deal with this problem? Changing nearest_sample in trim helps sometimes, but not always. The len of traces changes from example to example so I cant force for all examples the lenght with:

if len(data) > 20.0:

data = data[:-1]
else:
data = data

Thanks,

Blaž

Maybe try something like..

traces # should be your list of traces or a stream
nsamp = min(len(tr) for tr in traces)
for tr in traces:
    tr.data = tr.data[:nsamp]

T