Commit c037594d authored by Javier Quinteros's avatar Javier Quinteros

Improve parameters, help and add version information.

parent b0dc8a80
......@@ -28,6 +28,8 @@ from obspy import UTCDateTime
from obspy import Trace
from obspy import Stream
version = '0.1b'
class TDMS(object):
def __exit__(self, exc_type, exc_val, exc_tb):
......@@ -294,10 +296,6 @@ class TDMS(object):
logs.warning('Resetting chstart to %s' % (numChannels-1))
self.__chstop = numChannels-1
# logs.debug('channelSize: %s bytes' % channelSize)
# chunkSize = chunkSize + channelSize
# logs.info('chunkSize: %s bytes' % chunkSize)
# New or changed objects
newObjects = struct.unpack('%cI' % self.__endian, self.__fi.read(4))[0]
......@@ -335,7 +333,6 @@ class TDMS(object):
self.__currentfile += 1
self.__select_file()
def __iter_metadata__(self):
# Metadata
logs = logging.getLogger('Iterate Metadata')
......@@ -446,7 +443,7 @@ def str2date(dStr):
def main():
# Check verbosity in the output
msg = 'Read and convert waveforms generated by a DAS system.'
msg = 'Read, manipulate and convert seismic waveforms generated by a DAS system.'
parser = argparse.ArgumentParser(description=msg)
parser.add_argument('-l', '--loglevel',
help='Verbosity in the output.',
......@@ -463,10 +460,10 @@ def main():
help='End of the selected time window.\nFormat: 2019-02-01T00:01:02.123456Z',
default=None)
parser.add_argument('--chstart', type=int,
help='First channel to select',
help='First channel to export',
default=0)
parser.add_argument('--chstop', type=int,
help='Last channel to select',
help='Last channel to export',
default=None)
parser.add_argument('--chstep', type=int,
help='Step between channels in the selection',
......@@ -474,7 +471,9 @@ def main():
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.')
parser.add_argument('--version', action='version', version='dasconv v%s' % version)
parser.add_argument('filename',
help='Experiment to read and process. It is usually the first part of the filenames.')
args = parser.parse_args()
logging.basicConfig(level=args.loglevel)
......@@ -498,9 +497,9 @@ def main():
with td:
for data, stats in td:
st = Stream([Trace(data=data, header=stats)])
print(data)
# print(data)
st[0].decimate(args.decimate)
print(st[0].data)
# print(st[0].data)
try:
fout = openedfiles[(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