new function added: createAmplitude - routine for convenient ~obspy.core.event.Amplitude object creation

This commit is contained in:
Sebastian Wehling-Benatelli 2015-02-11 08:19:13 +01:00
parent d5c9ad41be
commit bec1ee1716
2 changed files with 11 additions and 14 deletions

View File

@ -3,7 +3,8 @@ from pylot.core.util.defaults import FILTERDEFAULTS
from pylot.core.util.errors import OptionsError, FormatError
from pylot.core.util.layouts import layoutStationButtons
from pylot.core.util.utils import fnConstructor, createArrival, createEvent,\
createPick, createOrigin, createMagnitude, getOwner, getHash
createPick, createAmplitude, createOrigin, createMagnitude, getOwner, \
getHash
from pylot.core.util.widgets import PickDlg, HelpForm, FilterOptionsDialog,\
PropertiesDlg, NewEventDlg, MPLWidget
from pylot.core.util.version import get_git_version as _getVersionString

View File

@ -115,7 +115,6 @@ def createEvent(origintime, cinfo, etype, resID=None, authority_id=None):
event.creation_info = cinfo
event.event_type = etype
return event
def createPick(picknum, picktime, eventnum, cinfo, phase, station, wfseedstr,
def createPick(origintime, picknum, picktime, eventnum, cinfo, phase, station,
@ -211,20 +210,17 @@ def createMagnitude(originID, origintime, cinfo, authority_id=None):
return magnitude
def createAmplitude():
pass
amplID = 'corrampl/' + genID
amplresID = ResourceIdentifier(id=amplID)
amplresID.convertIDToQuakeMLURI(authority_id='BUG')
amplitude = Amplitude()
def createAmplitude(pickID, amp, unit, category, origintime, cinfo,
authority_id=None):
amplresID = createResourceID(origintime, 'ampl', authority_id)
amplitude = ope.Amplitude()
amplitude.resource_id = amplresID
amplitude.creation_info = self.cinfo
amp = self.data[eventid][phase]['Amplitude'] * 1e-9
amplitude.creation_info = cinfo
amplitude.generic_amplitude = amp
amplitude.unit = AmplitudeUnit('m/s')
amplitude.magnitude_hint = 'Ml'
amplitude.type = AmplitudeCategory('point')
amplitude.pick_id = pickresID
amplitude.unit = ope.AmplitudeUnit(unit)
amplitude.type = ope.AmplitudeCategory(category)
amplitude.pick_id = pickID
return amplitude
def getOwner(fn):