Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Heimann
lassie
Commits
d9aa71ad
Commit
d9aa71ad
authored
Jun 01, 2016
by
Sebastian Heimann
Browse files
improved init subcommand
parent
d91994cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d9aa71ad
...
...
@@ -45,17 +45,26 @@ application which is part of [Pyrocko](http://emolch.github.io/pyrocko/).
snuffler
--stations
=
stations.txt
--events
=
confirmed-events.txt data/
```
#### Hints, when preparing your own dataset
:
#### Hints, when preparing your own dataset
*
NET.STA.LOC codes in waveform files must match exactly what is given in the
stations file.
*
Waveform files and directory layout do not have to follow any specific
convention, but with large files, data access can become less efficient. As a
rule of thumb, use files smaller than 1MB each. To cut a dataset into a new
chunksize, use the
J
ackseis program which is part of
chunksize, use the
`j
ackseis
`
program which is part of
[
Pyrocko
](
http://emolch.github.io/pyrocko/
)
, e.g. to cut a whole dataset into
hour files use:
`jackseis INPUT_DIR --tinc=3600 --output-dir=OUTPUT_DIR`
#### Running lassie from the command line
The Lassie earthquake detector can be run from the command line or by calling
Lassie's library functions from a Python script. Here we will demonstrate the
use of the
`lassie`
command line tool. To get brief help on available command
line options, run
`lassie --help`
or
`lassie <subcommand> --help`
. Once dataset
and configuration are ready, the command
`lassie scan <configfile>`
runs the
main detector algorithm. But first it must be configured...
#### Lassie configuration
Lassie reads its configuration from a text file in the
...
...
@@ -63,11 +72,12 @@ Lassie reads its configuration from a text file in the
configuration, run
```
bash
lassie init
>
config.
lassie
lassie init
>
config.
yaml
# or filling in already the names of the stations file and the waveform directory:
lassie init
--stations
=
stations.txt data
>
config.
lassie
lassie init
--stations
=
stations.txt
--data
=
data
>
config.
yaml
```
```
yaml
%YAML
1.1
---
!lassie.Config
...
...
apps/lassie
View file @
d9aa71ad
...
...
@@ -26,7 +26,7 @@ subcommand_descriptions = {
subcommand_usages
=
{
'init'
:
'init'
,
'scan'
:
'scan [options]'
,
'scan'
:
'scan
<configfile>
[options]'
,
'map-geometry'
:
'map-geometry <configfile> [options]'
,
}
...
...
@@ -109,18 +109,28 @@ def help_and_die(parser, message):
def
escape
(
s
):
return
s
.
replace
(
"'"
,
"
\\
'"
)
def
command_init
(
args
):
def
setup
(
parser
):
parser
.
add_option
(
'--stations'
,
dest
=
'stations_path'
,
metavar
=
'PATH'
,
help
=
'stations file'
)
parser
.
add_option
(
'--data'
,
dest
=
'data_paths'
,
default
=
[],
action
=
'append'
,
metavar
=
'PATH'
,
help
=
'data directory (this option may be repeated)'
)
parser
,
options
,
args
=
cl_parse
(
'init'
,
args
,
setup
=
setup
)
if
args
:
data_path
=
'
\n
'
.
join
(
"- '%s'"
%
escape
(
x
)
for
x
in
args
)
if
options
.
data_paths
:
s_data_paths
=
'
\n
'
.
join
(
"- '%s'"
%
escape
(
x
)
for
x
in
options
.
data_paths
)
else
:
data_path
=
"- 'DATA'"
s_
data_path
s
=
"- 'DATA'"
if
options
.
stations_path
:
stations_path
=
options
.
stations_path
...
...
@@ -131,12 +141,12 @@ def command_init(args):
--- !lassie.Config
## Configuration file for Lassie, your friendly earthquake detector
##
##
## Receiver coordinates can be read from a stations file in Pyrocko format:
stations_path: '%(stations_path)s'
## Receivers can also be listed in the config file, lat/lon and carthesian
## (x/y/z) = (North/East/Down) coordinates are supported and may be combined
## Receivers can also be listed in the config file, lat/lon and carthesian
## (x/y/z) = (North/East/Down) coordinates are supported and may be combined
## (interpreted as reference + offset). Omitted values are treated as zero.
# receivers:
# - !lassie.Receiver
...
...
@@ -150,7 +160,7 @@ stations_path: '%(stations_path)s'
## List of data directories. Lassie will recurse into subdirectories to find
## all contained waveform files.
data_paths:
%(data_path)s
%(
s_
data_path
s
)s
## Processing time interval (default: use time interval of available data)
# tmin: '2012-02-06 04:20:00'
...
...
@@ -204,8 +214,8 @@ detector_threshold: 100.0
## Output filename for detections
detections_path: 'detections.txt'
'''
%
dict
(
stations_path
=
stations_path
,
data_path
=
data_path
)
stations_path
=
stations_path
,
s_
data_path
s
=
s_
data_path
s
)
def
command_scan
(
args
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment