Commit d37e2cd5 authored by Javier Quinteros's avatar Javier Quinteros
Browse files

Byteorder and encoding type internally set in the headers.

parent 5b6754dc
......@@ -294,13 +294,23 @@ class TDMS(object):
# Data
logs = logging.getLogger('Iterate Data')
# Check encoding based on data type
if self.datatype.endswith('i2'):
enc = 1
elif self.datatype.endswith('f4'):
enc = 4
else:
raise Exception('Encoding type not supported to export in MiniSEED!')
# Loop through channels
for ch in range(self.__chstart, self.__chstop+1, self.__chstep):
data = self.__readdata(channel=ch)
stats = {'network': 'XX', 'station': '%05d' % ch, 'location': '',
'channel': 'FH1', 'npts': len(data),
'sampling_rate': self.sampling_rate,
'starttime': UTCDateTime(self.__twstart)}
'starttime': UTCDateTime(self.__twstart),
'mseed': {'byteorder': self.__endian, 'encoding': enc,
'reclen': 512}}
yield (data, stats)
def __iter_metadata__(self):
......@@ -458,16 +468,8 @@ def main():
starttime=dtstart, endtime=dtend)
with td:
if td.datatype.endswith('i2'):
enc = 1
elif td.datatype.endswith('f4'):
enc = 4
else:
raise Exception('Encoding type not supported to export in MiniSEED!')
for data, stats in td:
st = Stream([Trace(data=data, header=stats)])
print(stats)
print(data)
print(st)
st.write('%s.%s.%s.%s.mseed' % (stats['network'], stats['station'],
......
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