Compare commits
6 Commits
1b074d14ff
...
d5817adc46
Author | SHA1 | Date | |
---|---|---|---|
d5817adc46 | |||
14f01ec46d | |||
c4220b389e | |||
e1e0913e3a | |||
31ca0d7a85 | |||
c7f9ad4c6f |
@ -11,4 +11,6 @@ dependencies:
|
||||
- pyside2>=5.13.2
|
||||
- python=3.8.12
|
||||
- qt>=5.12.9
|
||||
- scipy=1.8.0
|
||||
- scipy=1.8.0
|
||||
- pyaml=6.0.1
|
||||
- joblib=1.4.2
|
@ -9,7 +9,7 @@ PyLoT - the Python picking and Localization Tool
|
||||
|
||||
This python library contains a graphical user interfaces for picking
|
||||
seismic phases. This software needs ObsPy (http://github.com/obspy/obspy/wiki)
|
||||
and the Qt4 libraries to be installed first.
|
||||
and the Qt libraries to be installed first.
|
||||
|
||||
PILOT has been developed in Mathworks' MatLab. In order to distribute
|
||||
PILOT without facing portability problems, it has been decided to re-
|
||||
|
2
pylot/correlation/__init__.py
Normal file
2
pylot/correlation/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
@ -2,22 +2,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import copy
|
||||
import logging
|
||||
import random
|
||||
import traceback
|
||||
import glob
|
||||
import json
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import yaml
|
||||
|
||||
from code_base.fmtomo_tools.fmtomo_teleseismic_utils import *
|
||||
from code_base.util.utils import get_metadata
|
||||
from joblib import Parallel, delayed
|
||||
from obspy import read, Stream, Trace
|
||||
from obspy import read, Stream, UTCDateTime, Trace
|
||||
from obspy.taup import TauPyModel
|
||||
from obspy.core.event.base import WaveformStreamID, ResourceIdentifier
|
||||
from obspy.core.event.origin import Pick
|
||||
from obspy.geodetics.base import gps2dist_azimuth
|
||||
from obspy.signal.cross_correlation import correlate, xcorr_max
|
||||
|
||||
from pylot.core.io.inputs import PylotParameter
|
||||
@ -26,6 +31,8 @@ from pylot.core.pick.autopick import autopickstation
|
||||
from pylot.core.util.utils import check4rotated
|
||||
from pylot.core.util.utils import identifyPhaseID
|
||||
from pylot.core.util.event import Event as PylotEvent
|
||||
from pylot.correlation.utils import (get_event_id, get_event_pylot, get_event_obspy_dmt, get_picks, write_json,
|
||||
get_metadata)
|
||||
|
||||
|
||||
class CorrelationParameters:
|
||||
|
61
pylot/correlation/utils.py
Normal file
61
pylot/correlation/utils.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import glob
|
||||
import json
|
||||
|
||||
from obspy import read_events
|
||||
|
||||
from pylot.core.util.dataprocessing import Metadata
|
||||
from pylot.core.util.obspyDMT_interface import qml_from_obspyDMT
|
||||
|
||||
|
||||
def get_event_obspy_dmt(eventdir):
|
||||
event_pkl_file = os.path.join(eventdir, 'info', 'event.pkl')
|
||||
if not os.path.exists(event_pkl_file):
|
||||
raise IOError('Could not find event path for event: {}'.format(eventdir))
|
||||
event = qml_from_obspyDMT(event_pkl_file)
|
||||
return event
|
||||
|
||||
|
||||
def get_event_pylot(eventdir, extension=''):
|
||||
event_id = get_event_id(eventdir)
|
||||
filename = os.path.join(eventdir, 'PyLoT_{}{}.xml'.format(event_id, extension))
|
||||
if not os.path.isfile(filename):
|
||||
return
|
||||
cat = read_events(filename)
|
||||
return cat[0]
|
||||
|
||||
|
||||
def get_event_id(eventdir):
|
||||
event_id = os.path.split(eventdir)[-1]
|
||||
return event_id
|
||||
|
||||
|
||||
def get_picks(eventdir, extension=''):
|
||||
event_id = get_event_id(eventdir)
|
||||
filename = 'PyLoT_{}{}.xml'
|
||||
filename = filename.format(event_id, extension)
|
||||
fpath = os.path.join(eventdir, filename)
|
||||
fpaths = glob.glob(fpath)
|
||||
if len(fpaths) == 1:
|
||||
cat = read_events(fpaths[0])
|
||||
picks = cat[0].picks
|
||||
return picks
|
||||
elif len(fpaths) == 0:
|
||||
print('get_picks: File not found: {}'.format(fpath))
|
||||
return
|
||||
print(f'WARNING: Ambiguous pick file specification. Found the following pick files {fpaths}\nFilemask: {fpath}')
|
||||
return
|
||||
|
||||
|
||||
def write_json(object, fname):
|
||||
with open(fname, 'w') as outfile:
|
||||
json.dump(object, outfile, sort_keys=True, indent=4)
|
||||
|
||||
|
||||
def get_metadata(eventdir):
|
||||
metadata_path = os.path.join(eventdir, 'resp')
|
||||
metadata = Metadata(inventory=metadata_path, verbosity=0)
|
||||
return metadata
|
@ -9,4 +9,6 @@ pyqtgraph=0.12.4
|
||||
pyside2=5.13.2
|
||||
python=3.8.12
|
||||
qt=5.12.9
|
||||
scipy=1.8.0
|
||||
scipy=1.8.0
|
||||
pyaml=6.0.1
|
||||
joblib=1.4.2
|
Loading…
Reference in New Issue
Block a user