obspy.core.trace.Trace.copy
- Trace.copy()[source]
Returns a deepcopy of the trace.
- Returns
Copy of trace.
This actually copies all data in the trace and does not only provide another pointer to the same data. At any processing step if the original data has to be available afterwards, this is the method to use to make a copy of the trace.
Example
Make a Trace and copy it:
>>> tr = Trace(data=np.random.rand(10)) >>> tr2 = tr.copy()
The two objects are not the same:
>>> tr2 is tr False
But they have equal data (before applying further processing):
>>> tr2 == tr True
The following example shows how to make an alias but not copy the data. Any changes on
tr3
would also change the contents oftr
.>>> tr3 = tr >>> tr3 is tr True >>> tr3 == tr True