make creating new event work

This commit is contained in:
Sebastian Wehling
2015-03-06 09:03:04 +01:00
parent a86a2efb8a
commit e321ad26b2
3 changed files with 14 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ from pylot.core.util.errors import OptionsError, FormatError, DatastructureError
from pylot.core.util.layouts import layoutStationButtons
from pylot.core.util.utils import fnConstructor, createArrival, createEvent,\
createPick, createAmplitude, createOrigin, createMagnitude, getOwner, \
getHash, getLogin
getHash, getLogin, createCreationInfo, createResourceID
from pylot.core.util.widgets import PickDlg, HelpForm, FilterOptionsDialog,\
PropertiesDlg, NewEventDlg, MPLWidget, createAction
from pylot.core.util.version import get_git_version as _getVersionString

View File

@@ -22,7 +22,6 @@ def fnConstructor(s):
fn = '_' + fn
return fn
def getLogin():
return pwd.getpwuid(os.getuid())[0]
@@ -36,6 +35,13 @@ def getHash(time):
hg.update(time.strftime('%Y-%m-%d %H:%M:%S.%f'))
return hg.hexdigest()
def createCreationInfo(agency_id=None, creation_time=None, author=None):
if author is None:
author = getLogin()
if creation_time is None:
creation_time = UTCDateTime()
return ope.CreationInfo(agency_id=agency_id, author=author,
creation_time=creation_time)
def createResourceID(timetohash, restype, authority_id=None, hrstr=None):
'''
@@ -58,7 +64,6 @@ def createResourceID(timetohash, restype, authority_id=None, hrstr=None):
resID.convertIDToQuakeMLURI(authority_id=authority_id)
return resID
def createOrigin(origintime, cinfo, latitude, longitude, depth, resID=None,
authority_id=None):
'''
@@ -88,7 +93,6 @@ def createOrigin(origintime, cinfo, latitude, longitude, depth, resID=None,
origin.depth = depth
return origin
def createEvent(origintime, cinfo, etype, resID=None, authority_id=None):
'''
createEvent - funtion to create an ObsPy Event
@@ -118,7 +122,6 @@ def createEvent(origintime, cinfo, etype, resID=None, authority_id=None):
event.event_type = etype
return event
def createPick(origintime, picknum, picktime, eventnum, cinfo, phase, station,
wfseedstr, authority_id):
'''
@@ -153,7 +156,6 @@ def createPick(origintime, picknum, picktime, eventnum, cinfo, phase, station,
pick.waveform_id = ope.ResourceIdentifier(id=wfseedstr, prefix='file:/')
return pick
def createArrival(origintime, pickresID, eventnum, cinfo, phase, station,
authority_id, azimuth=None, dist=None):
'''
@@ -191,7 +193,6 @@ def createArrival(origintime, pickresID, eventnum, cinfo, phase, station,
arrival.distance = None
return arrival
def createMagnitude(originID, origintime, cinfo, authority_id=None):
'''
createMagnitude - function to create an ObsPy Magnitude object
@@ -208,7 +209,6 @@ def createMagnitude(originID, origintime, cinfo, authority_id=None):
magnitude.origin_id = originID
return magnitude
def createAmplitude(pickID, amp, unit, category, origintime, cinfo,
authority_id=None):
amplresID = createResourceID(origintime, 'ampl', authority_id)
@@ -221,7 +221,6 @@ def createAmplitude(pickID, amp, unit, category, origintime, cinfo,
amplitude.pick_id = pickID
return amplitude
def getOwner(fn):
return pwd.getpwuid(os.stat(fn).st_uid).pw_name