new package io.py which should contain all import and export routines written by ourselves, such as reading old PILOT phase and location information file; implementation of the readPILOTevent function; new routines in utils: createArrival will be split into two functions: createPick and createArrival; also planned: createOrigin, createAmplitude and createMagnitude as well as giving createEvent functionality
This commit is contained in:
@@ -5,6 +5,8 @@ from pylot.core.util.errors import FormatError
|
||||
from pylot.core.util.layouts import layoutStationButtons
|
||||
from pylot.core.util.utils import fnConstructor
|
||||
from pylot.core.util.utils import createEvent
|
||||
from pylot.core.util.utils import getOwner
|
||||
from pylot.core.util.utils import createArrival
|
||||
from pylot.core.util.widgets import PickDlg
|
||||
from pylot.core.util.widgets import HelpForm
|
||||
from pylot.core.util.widgets import FilterOptionsDialog
|
||||
|
||||
@@ -10,4 +10,4 @@ class OptionsError(Exception):
|
||||
pass
|
||||
|
||||
class FormatError(Exception):
|
||||
pass
|
||||
pass
|
||||
@@ -2,8 +2,10 @@
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
from obspy.core.event import *
|
||||
import obspy.core.event as ope
|
||||
|
||||
def fnConstructor(s):
|
||||
|
||||
@@ -19,6 +21,34 @@ def fnConstructor(s):
|
||||
return fn
|
||||
|
||||
def createEvent(origintime, latitude, longitude, depth, **kwargs):
|
||||
evt = Event()
|
||||
evt = ope.Event()
|
||||
|
||||
def createArrival(picknum, picktime, eventnum, station, cinfo, phase, wfname,
|
||||
authority_id):
|
||||
pickID = 'pick/' + eventnum + '/' + station + '/{0:3d}'.format(picknum)
|
||||
pickresID = ope.ResourceIdentifier(id=pickID)
|
||||
pickresID.convertIDToQuakeMLURI(authority_id=authority_id)
|
||||
pick = ope.Pick()
|
||||
pick.resource_id = pickresID
|
||||
pick.time = picktime
|
||||
pick.creation_info = cinfo
|
||||
pick.phase_hint = phase
|
||||
pick.waveform_id = ope.ResourceIdentifier(id=wfname, prefix='file:/')
|
||||
|
||||
arriID = 'arrival/' + eventnum + '/' + station + '/{0}'.format(phase)
|
||||
arriresID = ope.ResourceIdentifier(id=arriID)
|
||||
arriresID.convertIDToQuakeMLURI(authority_id=authority_id)
|
||||
arrival = ope.Arrival()
|
||||
arrival.resource_id = arriresID
|
||||
arrival.creation_info = cinfo
|
||||
arrival.pick_id = pickresID
|
||||
arrival.phase = pick.phase_hint
|
||||
azi = self.location[eventid]['Backazimuth'] - 180
|
||||
arrival.azimuth = azi if azi > -180 else azi + 360
|
||||
arrival.distance = self.location[eventid]['Distance']['deg']
|
||||
|
||||
def getOwner(fn):
|
||||
return pwd.getpwuid(os.stat(fn).st_uid).pw_name
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user