reformatted the file to avoid usage of tabs and spaces and made a more pythonic splash message than multiple calls to print

This commit is contained in:
Sebastian Wehling-Benatelli 2015-11-04 13:11:48 +01:00
parent d8a59ac81d
commit 223902f2d4

View File

@ -32,19 +32,17 @@ def autoPyLoT(inputfile):
.. rubric:: Example .. rubric:: Example
""" """
print '************************************' splash = '''************************************\n
print '*********autoPyLoT starting*********' *********autoPyLoT starting*********\n
print 'The Python picking and Location Tool' The Python picking and Location Tool\n
print ' Version ', _getVersionString(), '2015' Version {version} 2015\n
print ' ' \n
print 'Authors:' Authors:\n
print 'S. Wehling-Benatelli' S. Wehling-Benatelli (Ruhr-Universität Bochum)\n
print ' Ruhr-Universität Bochum' L. Küperkoch (BESTEC GmbH, Landau i. d. Pfalz)\n
print 'L. Küperkoch' K. Olbert (Christian-Albrechts Universität zu Kiel)\n
print ' BESTEC GmbH, Landau (Pfalz)' ***********************************'''.format(version=_getVersionString())
print 'K. Olbert' print(splash)
print ' Christian-Albrechts Universität Kiel'
print '************************************'
# reading parameter file # reading parameter file
@ -77,7 +75,7 @@ def autoPyLoT(inputfile):
# get path to NLLoc executable # get path to NLLoc executable
nllocbin = parameter.getParam('nllocbin') nllocbin = parameter.getParam('nllocbin')
nlloccall = '%s/NLLoc' % nllocbin nlloccall = '%s/NLLoc' % nllocbin
# get name of phase file # get name of phase file
phasef = parameter.getParam('phasefile') phasef = parameter.getParam('phasefile')
phasefile = '%s/obs/%s' % (nllocroot, phasef) phasefile = '%s/obs/%s' % (nllocroot, phasef)
# get name of NLLoc-control file # get name of NLLoc-control file
@ -99,8 +97,8 @@ def autoPyLoT(inputfile):
if not parameter.hasParam('eventID'): if not parameter.hasParam('eventID'):
for event in [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]: for event in [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]:
data.setWFData(glob.glob(os.path.join(datapath, event, '*'))) data.setWFData(glob.glob(os.path.join(datapath, event, '*')))
print 'Working on event %s' % event print('Working on event %s' % event)
print data print(data)
wfdat = data.getWFData() # all available streams wfdat = data.getWFData() # all available streams
########################################################## ##########################################################
@ -148,7 +146,7 @@ def autoPyLoT(inputfile):
########################################################## ##########################################################
# !automated picking starts here! # !automated picking starts here!
picks = autopickevent(wfdat, parameter) picks = autopickevent(wfdat, parameter)
########################################################## ##########################################################
# locating # locating
if locflag == 1: if locflag == 1:
@ -166,15 +164,15 @@ def autoPyLoT(inputfile):
filedata = nllfile.read() filedata = nllfile.read()
if filedata.find(locfiles) < 0: if filedata.find(locfiles) < 0:
# replace old command # replace old command
filedata = filedata.replace('LOCFILES', locfiles) filedata = filedata.replace('LOCFILES', locfiles)
nllfile = open(locfile, 'w') nllfile = open(locfile, 'w')
nllfile.write(filedata) nllfile.write(filedata)
nllfile.close() nllfile.close()
# locate the event # locate the event
subprocess.call([nlloccall, locfile]) subprocess.call([nlloccall, locfile])
########################################################## ##########################################################
print '------------------------------------------' print '------------------------------------------'