Does anyone know if there is a way to correct the difference in the start time of the three components using obspy? My data is in mseed format. The data looks fine but there is a difference in the start time between components of the same trace. When processing the data the results are not correct because of that. If anyone knows how to do it with obspy or any other way please let me know.
you could calculate the latest start time for each trace
latest_start = max([tr.stats.starttime for tr in st])
then trim the stream accordingly
If you need sub-sample precision, you can use the interpolate method:
sr = st.stats.sampling_rate
See the docs of
Thank you guys for your answers. I have been using the st.trim() but unfortunately do not cut all the data at the same time. I have to cut hourly mseed files at the same exact time and I need the output files with the same number of samples.
I think you’d have to post more information, like what does
print(st) say and what exactly is the problem. The above answers seem to be the best answer anybody could give without more info.
Excuse me if I did not write a clear answer. I know these are the best answer, I really appreciated it. The problem is maybe the data. When I used st.trim() the closest sample is selected but this is no the same in all my files. For that reason the output files are not cut at the same start time and end time.