Commit ad885016 authored by Javier Quinteros's avatar Javier Quinteros

Print metadata to stdout and in a nicer format

parent e5ec372d
......@@ -18,8 +18,10 @@
import argparse
import os
import sys
import logging
import struct
import pprint
import datetime
import numpy as np
from math import floor
......@@ -218,6 +220,8 @@ class TDMS(object):
def readMetadata(self):
# Metadata
logs = logging.getLogger('Read Metadata')
handler = logging.StreamHandler(sys.stdout)
logs.addHandler(handler)
self.__fi.seek(self.__HEADERLEN, 0)
# Number of objects (unsigned int - 32b)
......@@ -252,7 +256,6 @@ class TDMS(object):
except:
pass
continue
elif not rawDataIdx:
......@@ -541,7 +544,10 @@ def main():
curstream = None
for data in td:
if args.metadata:
logs.info(data)
if isinstance(data, dict):
pprint.pprint(data)
else:
print(data)
else:
if curstream != '%s.%s.%s.%s' % (data[1]['network'], data[1]['station'], data[1]['location'], data[1]['channel']):
# Save the previous Stream completely
......
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