Commit 8b03b46d authored by Javier Quinteros's avatar Javier Quinteros
Browse files

Write the header as a Stats object

Timing Quality is still not being properly recognized
parent 05b73ebc
......@@ -20,6 +20,8 @@ import datetime
import os
import struct
from obspy import UTCDateTime
from obspy.core.trace import Stats
from obspy.core.util.attribdict import AttribDict
import numpy as np
from math import floor
from math import ceil
......@@ -137,7 +139,6 @@ class TDMS(object):
logs.error('Channel code has to be three alphanumeric characters')
raise TypeError('Channel code has to be three alphanumeric characters')
self.__chstart = chstart
self.__chstop = chstop
self.__chstep = chstep
......@@ -664,14 +665,21 @@ class TDMS(object):
data = self.__readdata(channels=self.__channels)
# Loop through channels
for ch in self.__channels:
stats = {'network': self.__networkcode, 'station': '%05d' % ch, 'location': '',
'channel': self.__channelcode, 'npts': len(data[ch]),
'sampling_rate': self.sampling_rate,
'starttime': UTCDateTime(self.__twstart),
'mseed': {'byteorder': self.__endian,
'dataquality': 'D',
'record_length': 4096,
'blkt1001': {'timing_quality': 100.0}}}
stats = Stats()
stats.network = self.__networkcode
stats.station = '%05d' % ch
stats.location = ''
stats.channel = self.__channelcode
stats.sampling_rate = self.sampling_rate
stats.npts = len(data[ch])
stats.starttime = UTCDateTime(self.__twstart)
stats.mseed = AttribDict()
stats.mseed.byteorder = self.__endian
stats.mseed.dataquality = 'D'
stats.mseed.record_length = 4096
stats.mseed.blkt1001 = AttribDict()
stats.mseed.blkt1001.timing_quality = 100
logs.debug('Data length: %d; First component: %s' % (len(data[ch]), data[ch][0]))
yield data[ch], stats
......
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