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
3347607f
Commit
3347607f
authored
Jun 10, 2016
by
Sebastian Heimann
Browse files
add command line options --tmin and --tmax
parent
30d8d90f
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/lassie
View file @
3347607f
...
...
@@ -18,6 +18,13 @@ def d2u(d):
return
d
.
replace
(
'-'
,
'_'
)
def
str_to_time
(
s
):
try
:
return
util
.
str_to_time
(
s
)
except
util
.
TimeStrError
,
e
:
raise
lassie
.
LassieError
(
str
(
e
))
subcommand_descriptions
=
{
'init'
:
'create initial configuration file'
,
'scan'
:
'detect seismic events'
,
...
...
@@ -236,16 +243,35 @@ def command_scan(args):
'--stop-after-first'
,
dest
=
'stop_after_first'
,
action
=
'store_true'
,
help
=
'show plot for every detection found'
)
parser
.
add_option
(
'--tmin'
,
dest
=
'tmin'
,
metavar
=
"'YYYY-MM-DD HH:MM:SS.XXX'"
,
help
=
'beginning of processing time window '
'(overrides config file settings)'
)
parser
.
add_option
(
'--tmax'
,
dest
=
'tmax'
,
metavar
=
"'YYYY-MM-DD HH:MM:SS.XXX'"
,
help
=
'end of processing time window '
'(overrides config file settings)'
)
parser
,
options
,
args
=
cl_parse
(
'scan'
,
args
,
setup
=
setup
)
if
len
(
args
)
!=
1
:
help_and_die
(
parser
,
'missing argument'
)
config_path
=
args
[
0
]
config
=
lassie
.
read_config
(
config_path
)
print
config
try
:
tmin
=
tmax
=
None
if
options
.
tmin
:
tmin
=
str_to_time
(
options
.
tmin
)
if
options
.
tmax
:
tmax
=
str_to_time
(
options
.
tmax
)
lassie
.
scan
(
config
,
override_tmin
=
tmin
,
override_tmax
=
tmax
,
force
=
options
.
force
,
show_detections
=
options
.
show_detections
,
show_movie
=
options
.
show_movie
,
...
...
src/core.py
View file @
3347607f
...
...
@@ -15,6 +15,8 @@ logger = logging.getLogger('lassie.core')
def
scan
(
config
,
override_tmin
=
None
,
override_tmax
=
None
,
show_detections
=
False
,
show_movie
=
False
,
force
=
False
,
...
...
@@ -63,8 +65,8 @@ def scan(
station_weights
=
{}
tmin
=
config
.
tmin
tmax
=
config
.
tmax
tmin
=
override_tmin
or
config
.
tmin
tmax
=
override_tmax
or
config
.
tmax
for
trs
in
p
.
chopper
(
tmin
=
tmin
,
tmax
=
tmax
,
tinc
=
tinc
,
tpad
=
tpad
,
want_incomplete
=
False
,
...
...
Write
Preview
Markdown
is supported
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