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.errors import OptionsError, FormatError
from pylot.core.util.layouts import layoutStationButtons from pylot.core.util.layouts import layoutStationButtons
from pylot.core.util.utils import fnConstructor, createArrival, createEvent,\ 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,\ from pylot.core.util.widgets import PickDlg, HelpForm, FilterOptionsDialog,\
PropertiesDlg, NewEventDlg, MPLWidget PropertiesDlg, NewEventDlg, MPLWidget
from pylot.core.util.version import get_git_version as _getVersionString 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.creation_info = cinfo
event.event_type = etype event.event_type = etype
return event return event
def createPick(picknum, picktime, eventnum, cinfo, phase, station, wfseedstr,
def createPick(origintime, picknum, picktime, eventnum, cinfo, phase, station, def createPick(origintime, picknum, picktime, eventnum, cinfo, phase, station,
@ -211,20 +210,17 @@ def createMagnitude(originID, origintime, cinfo, authority_id=None):
return magnitude return magnitude
def createAmplitude(): def createAmplitude(pickID, amp, unit, category, origintime, cinfo,
pass authority_id=None):
amplID = 'corrampl/' + genID amplresID = createResourceID(origintime, 'ampl', authority_id)
amplresID = ResourceIdentifier(id=amplID) amplitude = ope.Amplitude()
amplresID.convertIDToQuakeMLURI(authority_id='BUG')
amplitude = Amplitude()
amplitude.resource_id = amplresID amplitude.resource_id = amplresID
amplitude.creation_info = self.cinfo amplitude.creation_info = cinfo
amp = self.data[eventid][phase]['Amplitude'] * 1e-9
amplitude.generic_amplitude = amp amplitude.generic_amplitude = amp
amplitude.unit = AmplitudeUnit('m/s') amplitude.unit = ope.AmplitudeUnit(unit)
amplitude.magnitude_hint = 'Ml' amplitude.type = ope.AmplitudeCategory(category)
amplitude.type = AmplitudeCategory('point') amplitude.pick_id = pickID
amplitude.pick_id = pickresID return amplitude
def getOwner(fn): def getOwner(fn):