Modify ↓
Ticket #65 (closed task: fixed)
Merging with very small differences in each sample.
| Reported by: | krischer | Owned by: | |
|---|---|---|---|
| Priority: | major | Component: | ObsPy library |
| Keywords: | Cc: |
Description
Should we support merging the following to Traces?
| | | | Trace 1
| | | Trace 2
It currently works. What should be the endtime? Currenly each sample of Trace 2 is shifted to fit Trace 1.
Attachments
Change History
comment:2 Changed 2 years ago by anonymous
- merge with method=0 should ofc mark this data as gap
- using method>0 should allow interpolation - but mark somehow the timeshift within the stats attribute of the trace (e.g. quality flag) - a warning alone won't be enough for automatic processing
comment:3 Changed 2 years ago by beyreuth
- If the offset is more than 5% of the sampling interval we should refuse to merge such traces. The result is just wrong.
- There is no way to automatically find which timestamp is the correct one.
comment:4 Changed 2 years ago by krischer
- By default libmseed has a time tolerance between two records of 1/2 sampling period. So we should either change the default value or adhere to the same tolerance.
- Interpolation would probably also be pretty cheap, e.g. in the example above assuming 5% offset something like
trace2 = 0.05*trace2[:-1] + 0.95*trace2[1:]
The first sample needs seperate treatment.
comment:6 Changed 22 months ago by barsch
>>> from obspy.core import UTCDateTime, Trace >>> t1=Trace(data=np.arange(100)) >>> t2=Trace(data=np.arange(100)) >>> t1.stats.starttime = UTCDateTime(100) >>> t2.stats.starttime = UTCDateTime(100) >>> print t1 ... | 1970-01-01T00:01:40.000000Z - 1970-01-01T00:03:19.000000Z | 1.0 Hz, 100 samples >>> print t2 ... | 1970-01-01T00:03:20.500000Z - 1970-01-01T00:04:59.500000Z | 1.0 Hz, 100 samples >>> muh = t1 + t2 >>> print(muh) ... | 1970-01-01T00:01:40.000000Z - 1970-01-01T00:04:59.000000Z | 1.0 Hz, 200 samples >>> muh.data[99] 99 >>> muh.data[100] 0 >>> muh.data[101] 1
comment:7 Changed 19 months ago by barsch
- Component set to ObsPy library
group decision: raise a warning within merge() - needs test case
comment:8 Changed 10 days ago by barsch
- Status changed from new to closed
- Resolution set to fixed
This should now be invalid by using UTCDateTime.DEFAULT_PRECISION - see http://docs.obspy.org/packages/autogen/obspy.core.utcdatetime.UTCDateTime.html#precision.
Note: See
TracTickets for help on using
tickets.

It would certainly be better to use a linear interpolation of trace2 on the sampling "grid" of trace1. Would this be too slow/expensive? Anyway, it's a time error of subsample order so this might be overkill... But if the samples are shifted it should at least print a warning I think...