Debuged loop, seperate loops for single event or complete data structure processing, respectively.

This commit is contained in:
Ludger Küperkoch 2015-06-01 16:28:27 +02:00
parent 85f0717f10
commit 5488d4e0fc

View File

@ -12,7 +12,6 @@ from pylot.core.util import _getVersionString
from pylot.core.read import Data, AutoPickParameter from pylot.core.read import Data, AutoPickParameter
from pylot.core.pick.run_autopicking import run_autopicking from pylot.core.pick.run_autopicking import run_autopicking
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
import pdb
__version__ = _getVersionString() __version__ = _getVersionString()
@ -53,8 +52,8 @@ def autoPyLoT(inputfile):
if parameter.hasParam('eventID'): if parameter.hasParam('eventID'):
dsfields['eventID'] = parameter.getParam('eventID') dsfields['eventID'] = parameter.getParam('eventID')
exf.append('eventID') exf.append('eventID')
datastructure.modifyFields(**dsfields)
datastructure.modifyFields(**dsfields)
datastructure.setExpandFields(exf) datastructure.setExpandFields(exf)
# get streams # get streams
@ -62,26 +61,41 @@ def autoPyLoT(inputfile):
datapath = datastructure.expandDataPath() datapath = datastructure.expandDataPath()
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)]:
print 'Reading %s' %event
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 data
wfdat = data.getWFData() # all available streams
##########################################################
# !automated picking starts here!
procstats = []
for i in range(len(wfdat)):
stationID = wfdat[i].stats.station
#check if station has already been processed
if stationID not in procstats:
procstats.append(stationID)
#find corresponding streams
statdat = wfdat.select(station=stationID)
run_autopicking(statdat, parameter)
#for single event processing #for single event processing
else: else:
data.setWFData(glob.glob(os.path.join(datapath, parameter.getParam('eventID'), '*'))) data.setWFData(glob.glob(os.path.join(datapath, parameter.getParam('eventID'), '*')))
print 'Working on event ', parameter.getParam('eventID')
print data print data
wfdat = data.getWFData() # all available streams wfdat = data.getWFData() # all available streams
##########################################################
########################################################## # !automated picking starts here!
# !automated picking starts here! procstats = []
procstats = [] for i in range(len(wfdat)):
for i in range(len(wfdat)): stationID = wfdat[i].stats.station
stationID = wfdat[i].stats.station #check if station has already been processed
#check if station has already been processed if stationID not in procstats:
if stationID not in procstats: procstats.append(stationID)
procstats.append(stationID) #find corresponding streams
#find corresponding streams statdat = wfdat.select(station=stationID)
statdat = wfdat.select(station=stationID) run_autopicking(statdat, parameter)
run_autopicking(statdat, parameter)
if __name__ == "__main__": if __name__ == "__main__":