Trouble Adding Traces

Hi,

I am trying to copy the beginning section of a trace and prepend the beginning of the trace with a reversed copy of that section (really several reversed copies). I am not sure if this is possible using the fill_value option in something like a trace.trim. I have tried using numpy to do this but I am not very familiar with it nor how traces are set up and I end up with an error about the arrays being different shapes. Any advice on how to best do this would be much appreciated.

Thanks

Mike

Hi Mike,

I guess the following untested snippet would work - it will prepend the first 100 samples in reverse order to the trace.

import obspy

import numpy as np

tr = obspy.read()[0]� # Dummy example data

tr.data = np.concatenate([tr.data[:100][::-1], tr.data])

tr.stats.starttime -= tr.stats.delta * 100� # Shift the start time

Cheers!

Lion