several bugfixes for the read routine for PILOT event data (testing not yet completed, see also tickets #145 and #146)
This commit is contained in:
parent
1b86d3bfa4
commit
c35eea4588
@ -64,7 +64,7 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
|
||||
minute = int(loc['mm'])
|
||||
second = int(loc['ss'])
|
||||
|
||||
if UTCDateTime(year=year + 2000) < UTCDateTime.utcnow():
|
||||
if year + 2000 < UTCDateTime.utcnow().year:
|
||||
year += 2000
|
||||
else:
|
||||
year += 1900
|
||||
@ -83,6 +83,7 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
|
||||
|
||||
origin = createOrigin(eventDate, loccinfo, lat, lon, dep, eventNum)
|
||||
for n, pick in enumerate(phases['Ptime']):
|
||||
if pick[0] > 0:
|
||||
kwargs = {'year': int(pick[0]),
|
||||
'month': int(pick[1]),
|
||||
'day': int(pick[2]),
|
||||
@ -105,24 +106,24 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
|
||||
ppicktime = UTCDateTime(**kwargs)
|
||||
|
||||
for picktime, phase in [(ppicktime, 'P'), (spicktime, 'S')]:
|
||||
if picktime is not None:
|
||||
if phase == 'P':
|
||||
wffn = os.path.join([sdir, '{0}*{1}*'.format(stations[n],
|
||||
'z')])
|
||||
wffn = os.path.join(sdir, '{0}*{1}*'.format(
|
||||
stations[n].strip(), 'z'))
|
||||
else:
|
||||
wffn = os.path.join([sdir, '{0}*{1}*'.format(stations[n],
|
||||
'[ne]')])
|
||||
wffn = os.path.join(sdir, '{0}*{1}*'.format(
|
||||
stations[n].strip(), '[ne]'))
|
||||
print wffn
|
||||
pick = createPick(eventDate, np, picktime, eventNum, pickcinfo,
|
||||
phase,
|
||||
stat[n], wffn, authority_id)
|
||||
phase, stations[n], wffn, authority_id)
|
||||
event.picks.append(pick)
|
||||
pickID = pick.get('resource_id')
|
||||
arrival = createArrival(pickID, eventNum, pickcinfo, phase,
|
||||
stat[n], authority_id)
|
||||
pickID = pick.get('id')
|
||||
arrival = createArrival(eventDate, pickID, eventNum, pickcinfo,
|
||||
phase, stations[n], authority_id)
|
||||
origin.arrivals.append(arrival)
|
||||
np += 1
|
||||
|
||||
magnitude = createMagnitude(origin.get('resource_id'), eventDate,
|
||||
loccinfo,
|
||||
magnitude = createMagnitude(origin.get('id'), eventDate, loccinfo,
|
||||
authority_id)
|
||||
magnitude.mag = float(loc['Mnet'])
|
||||
magnitude.magnitude_type = 'Ml'
|
||||
@ -130,10 +131,10 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
|
||||
event.picks.append(pick)
|
||||
event.origins.append(origin)
|
||||
event.magnitudes.append(magnitude)
|
||||
return event
|
||||
|
||||
except AttributeError, e:
|
||||
raise AttributeError('{0} - Matlab LOC files {1} and {2} contains \
|
||||
insufficient data!'.format(e, phasfn, locfn))
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user