Commit a9b0c4b1 authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

Merge branch 'snuffle' into 'master'

Snuffle

lassie snuffle <config-file>  opens snuffler with station meta data, waveforms and detections.

See merge request !1
parents 2f88f082 b5bb55c1
......@@ -189,3 +189,12 @@ Now run the detector with
lassie scan config.yaml
```
#### Scrutinize detections
After the detection has finished have a look at the results using Pyrocko's
[Snuffler](http://emolch.github.io/pyrocko/current/snuffler.html):
```bash
lassie snuffle config.yaml
```
Waveform data are loaded together with station meta data and detections.
......@@ -28,13 +28,15 @@ def str_to_time(s):
subcommand_descriptions = {
'init': 'create initial configuration file',
'scan': 'detect seismic events',
'map-geometry': 'make station map'
'map-geometry': 'make station map',
'snuffle': 'snuffle'
}
subcommand_usages = {
'init': 'init',
'scan': 'scan <configfile> [options]',
'map-geometry': 'map-geometry <configfile> [options]',
'snuffle': 'snuffle <configfile>',
}
subcommands = subcommand_descriptions.keys()
......@@ -51,6 +53,7 @@ Subcommands:
init %(init)s
scan %(scan)s
map-geometry %(map_geometry)s
snuffle %(snuffle)s
To get further help and a list of available options for any subcommand run:
......@@ -292,6 +295,18 @@ def command_map_geometry(args):
lassie.map_geometry(config, output_path)
def command_snuffle(args):
parser, options, args = cl_parse('snuffle', args)
if len(args) != 1:
help_and_die(parser, 'missing arguments')
config_path = args[0]
config = lassie.read_config(config_path)
lassie.snuffle(config)
if __name__ == '__main__':
usage_sub = 'fomosto %s [options]'
......
import time
import numpy as num
from pyrocko import automap
from pyrocko import automap, pile, snuffler, model, gui_util, util
from pyrocko import orthodrome
from lassie import receiver, grid as gridmod, geo
......@@ -225,6 +226,7 @@ def plot_detection(
t-t0,
dist + scalefactor*amp + ishifter*scalefactor*0.1,
color=color)
axes3.text(t[0]-t0, dist, '.'.join(tr.nslc_id), verticalalignment='top')
for tr in trs_raw:
istation = station_index[tr.nslc_id[:3]]
......@@ -296,10 +298,42 @@ def plot_detection(
plt.show()
def snuffle(config):
receivers = config.get_receivers()
stations = set()
for r in receivers:
n, s, l = r.codes[:3]
stations.add(model.Station(lat=r.lat, lon=r.lon,
network=n, station=s, location=l))
markers = []
detections_path = config.detections_path
with open(config.detections_path, 'r') as f:
for line in f.readlines():
data = line.split()
i, t_d, t_t, apeak, latpeak, lonpeak, xpeak, ypeak, zpeak = data
lat, lon = orthodrome.ne_to_latlon(
float(latpeak), float(lonpeak), float(ypeak), float(xpeak))
t = util.str_to_time("%s %s" % (t_d, t_t))
label = "%s-%s" % (i, apeak)
e = model.Event(lat=lat, lon=lon, depth=float(zpeak)*1000.,
name=label, time=t)
m = gui_util.EventMarker(e)
markers.append(m)
trs = []
paths = config.data_paths
paths.append('stackmax')
p = pile.make_pile(paths=paths, fileformat='detect')
snuffler.snuffle(p, markers=markers, stations=stations)
__all__ = [
'map_geometry',
'map_gmt',
'plot_detection',
'plot_geometry_carthesian',
'plot_receivers',
'snuffle',
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment