Commit cbcc8836 authored by Marius Kriegerowski's avatar Marius Kriegerowski
Browse files

snuffle results

parent 2f88f082
......@@ -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)
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(
dist + scalefactor*amp + ishifter*scalefactor*0.1,
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(
def snuffle(config):
receivers = config.get_receivers()
stations = set()
for r in receivers:
n, s, l =[:3]
stations.add(model.Station(, 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)
trs = []
paths = config.data_paths
p = pile.make_pile(paths=paths, fileformat='detect')
snuffler.snuffle(p, markers=markers, stations=stations)
__all__ = [
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