Commit 9170ea13 authored by Javier Quinteros's avatar Javier Quinteros

Create new Traces instead of modify them

parent 4925f419
......@@ -22,6 +22,7 @@ import os
from copy import copy
from datetime import timedelta
from obspy import UTCDateTime
from obspy import Trace
from abc import ABCMeta
from abc import abstractmethod
......@@ -113,11 +114,12 @@ class Wavelets(Archive):
# Reconstruct signal
rec = pywt.waverec(coeffs2, wav)
trace.data = rec.round().astype(np.int32)
trace2 = Trace(rec.round().astype(np.int32), header=trace.stats)
# Write an ASCII version of the reconstructed signal
filename = '%s-%05d-wav0001rec.mseed' % (nslc, self.__chunknum)
trace.stats['channel'] = 'W1'
trace.write(filename, format='MSEED')
trace2.stats['channel'] = 'W1'
print(trace2.stats)
trace2.write(filename, format='MSEED')
# Remove one digit of precision to coefficients
coeffs3 = list()
......@@ -134,11 +136,11 @@ class Wavelets(Archive):
# Reconstruct signal
rec = pywt.waverec(coeffs3, wav)
trace.data = rec.round().astype(np.int32)
trace3 = Trace(rec.round().astype(np.int32), header=trace.stats)
# Write an ASCII version of the reconstructed signal
filename = '%s-%05d-wav0010rec.mseed' % (nslc, self.__chunknum)
trace.stats['channel'] = 'W2'
trace.write(filename, format='MSEED')
trace3.stats['channel'] = 'W2'
trace3.write(filename, format='MSEED')
# Remove two digits of precision to coefficients
coeffs4 = list()
......@@ -155,11 +157,11 @@ class Wavelets(Archive):
# Reconstruct signal
rec = pywt.waverec(coeffs4, wav)
trace.data = rec.round().astype(np.int32)
trace4 = Trace(rec.round().astype(np.int32), header=trace.stats)
# Write an ASCII version of the reconstructed signal
filename = '%s-%05d-wav0100rec.mseed' % (nslc, self.__chunknum)
trace.stats['channel'] = 'W3'
trace.write(filename, format='MSEED')
trace4.stats['channel'] = 'W3'
trace4.write(filename, format='MSEED')
# Remove three digits of precision to coefficients
coeffs5 = list()
......@@ -176,11 +178,11 @@ class Wavelets(Archive):
# Reconstruct signal
rec = pywt.waverec(coeffs5, wav)
trace.data = rec.round().astype(np.int32)
trace5 = Trace(rec.round().astype(np.int32), header=trace.stats)
# Write an ASCII version of the reconstructed signal
filename = '%s-%05d-wav1000rec.mseed' % (nslc, self.__chunknum)
trace.stats['channel'] = 'W4'
trace.write(filename, format='MSEED')
trace5.stats['channel'] = 'W4'
trace5.write(filename, format='MSEED')
# Increment the chunk number
self.__chunknum += 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment