Commit b0dc8a80 authored by Javier Quinteros's avatar Javier Quinteros

Decimate using Obspy. Includes filtering to avoid aliasing.

parent 76d79d81
......@@ -277,6 +277,7 @@ class TDMS(object):
self.__sampleend = self.samples-1
else:
self.__sampleend = ceil((self.__twend - self.starttime).total_seconds() * self.sampling_rate)
# print(self.__twend, self.starttime, (self.__twend - self.starttime).total_seconds(), self.__sampleend)
logs.info('Samples: %s' % self.samples)
logs.info('Samples selected: %s-%s' % (self.__samplestart, self.__sampleend))
......@@ -326,7 +327,7 @@ class TDMS(object):
'channel': 'FH1', 'npts': len(data),
'sampling_rate': self.sampling_rate,
'starttime': UTCDateTime(self.__twstart),
'mseed': {'byteorder': self.__endian, 'encoding': enc,
'mseed': {'byteorder': self.__endian,
'reclen': 512}}
yield (data, stats)
......@@ -470,6 +471,9 @@ def main():
parser.add_argument('--chstep', type=int,
help='Step between channels in the selection',
default=1)
parser.add_argument('--decimate', type=int,
help='Factor by which the sampling rate is lowered by decimation.',
default=5)
parser.add_argument('filename', help='File name to read and process.')
args = parser.parse_args()
......@@ -495,7 +499,9 @@ def main():
for data, stats in td:
st = Stream([Trace(data=data, header=stats)])
print(data)
print(st)
st[0].decimate(args.decimate)
print(st[0].data)
try:
fout = openedfiles[(stats['network'], stats['station'],
stats['location'], stats['channel'])]
......
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