Commit 0ab93cbf authored by Daniela Kühn's avatar Daniela Kühn
Browse files

Merged stackmax_path and master

parent df292896
......@@ -223,6 +223,9 @@ detector_threshold: 100.0
## Output filename for detections
detections_path: 'detections.txt'
## Output directory for stack maximum trace
stackmax_path: 'stackmax'
''' % dict(
stations_path=stations_path,
s_data_paths=s_data_paths)
......
......@@ -38,7 +38,11 @@ class Config(Object):
detections_path = String.T(
optional=True,
help='output file name for for detections')
help='output file name for detections')
stackmax_path = String.T(
optional=True,
help='output file name for stack functions')
grid = grid.Grid.T(
optional=True,
......
......@@ -55,14 +55,32 @@ def scan(
if op.exists(config.detections_path):
if force:
os.unlink(config.detections_path)
shutil.rmtree('stackmax')
os.mkdir('stackmax')
if config.stackmax_path:
if op.exists(config.stackmax_path):
shutil.rmtree(config.stackmax_path)
os.mkdir(config.stackmax_path)
else:
shutil.rmtree('stackmax')
os.mkdir('stackmax')
else:
raise common.LassieError(
'detections file already exists: %s' % config.detections_path)
util.ensuredirs(config.detections_path)
else:
if config.stackmax_path:
if op.exists(config.stackmax_path):
if force:
shutil.rmtree(config.stackmax_path)
else:
raise common.LassieError(
'stackmax directory already exists: %s' % config.stackmax_path)
util.ensuredirs(config.stackmax_path)
grid = config.get_grid()
receivers = config.get_receivers()
......@@ -262,8 +280,11 @@ def scan(
return
tr_stackmax.chop(wmin, wmax)
io.save([tr_stackmax, tr_stackmax_indx], 'stackmax/trace_%(tmin_ms)s.mseed')
if config.stackmax_path:
io.save([tr_stackmax, tr_stackmax_indx], os.path.join(config.stackmax_path, 'trace_%(tmin_ms)s.mseed'))
else:
io.save([tr_stackmax, tr_stackmax_indx], 'stackmax/trace_%(tmin_ms)s.mseed')
__all__ = [
'scan',
......
import time
import os
import numpy as num
from pyrocko import automap, pile, snuffler, model, gui_util, util
from pyrocko import orthodrome
......
......@@ -267,7 +267,11 @@ def snuffle(config):
lat=lat, lon=lon, network=n, station=s, location=l))
paths = config.data_paths
paths.append('stackmax')
if config.stackmax_path:
paths.append(config.stackmax_path)
else:
paths.append('stackmax')
p = pile.make_pile(paths=paths, fileformat='detect')
snuffler.snuffle(p, stations=stations,
launch_hook=load_snuffling)
......
Markdown is supported
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