forked from ahotovec/REDPy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremoveFamily.py
More file actions
57 lines (45 loc) · 2.09 KB
/
removeFamily.py
File metadata and controls
57 lines (45 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# REDPy - Repeating Earthquake Detector in Python
# Copyright (C) 2016 Alicia Hotovec-Ellis (ahotovec@gmail.com)
# Licensed under GNU GPLv3 (see LICENSE.txt)
import redpy.config
import redpy.table
import argparse
# Added this to remove the slew of warnings obspy/numpy was throwing at me
import warnings
warnings.filterwarnings("ignore")
"""
Run this script to manually remove families/clusters (e.g., correlated noise that made it
past the 'junk' detector). Reclusters and remakes images when done.
usage: removeFamily.py [-h] [-v] [-c CONFIGFILE] N [N ...]
positional arguments:
N family number(s) to be moved and deleted
optional arguments:
-h, --help show this help message and exit
-v, --verbose increase written print statements
-c CONFIGFILE, --configfile CONFIGFILE
use configuration file named CONFIGFILE instead of
default settings.cfg
"""
parser = argparse.ArgumentParser(description=
"Run this script to manually remove families/clusters")
parser.add_argument('famnum', metavar='N', type=int, nargs='+',
help="family number(s) to be moved and deleted")
parser.add_argument("-v", "--verbose", action="count", default=0,
help="increase written print statements")
parser.add_argument("-c", "--configfile",
help="use configuration file named CONFIGFILE instead of default settings.cfg")
args = parser.parse_args()
if args.configfile:
opt = redpy.config.Options(args.configfile)
if args.verbose: print("Using config file: {0}".format(args.configfile))
else:
opt = redpy.config.Options("settings.cfg")
if args.verbose: print("Using config file: settings.cfg")
if args.verbose: print("Opening hdf5 table: {0}".format(opt.filename))
h5file, rtable, otable, ttable, ctable, jtable, dtable, ftable = redpy.table.openTable(opt)
redpy.table.removeFamilies(rtable, ctable, dtable, ftable, args.famnum, opt)
if args.verbose: print("Creating plots...")
redpy.plotting.createPlots(rtable, ftable, ttable, ctable, opt)
if args.verbose: print("Closing table...")
h5file.close()
if args.verbose: print("Done")