Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # parameters.yaml # survBot.py
This commit is contained in:
commit
bf82148449
@ -4,7 +4,7 @@ networks: ["1Y", "HA"] # select networks, list or str
|
|||||||
stations: "*" # select stations, list or str
|
stations: "*" # select stations, list or str
|
||||||
locations: "*" # select locations, list or str
|
locations: "*" # select locations, list or str
|
||||||
channels: ["EX1", "EX2", "EX3", "VEI",
|
channels: ["EX1", "EX2", "EX3", "VEI",
|
||||||
"VM1", "VM2", "VM3"] # Specify SOH channels, currently supported EX[1-3], VEI and VM[1-3]
|
"VM1", "VM2", "VM3", "LCQ"] # Specify SOH channels, currently supported EX[1-3], VEI and VM[1-3]
|
||||||
stations_blacklist: ["TEST", "EREA"] # exclude these stations
|
stations_blacklist: ["TEST", "EREA"] # exclude these stations
|
||||||
networks_blacklist: [] # exclude these networks
|
networks_blacklist: [] # exclude these networks
|
||||||
interval: 60 # Perform checks every x seconds
|
interval: 60 # Perform checks every x seconds
|
||||||
@ -42,9 +42,11 @@ THRESHOLDS:
|
|||||||
pb_thresh: 0.2 # Threshold for PowBox Voltage check +/- (V)
|
pb_thresh: 0.2 # Threshold for PowBox Voltage check +/- (V)
|
||||||
max_temp: 50 # max temperature for temperature warning
|
max_temp: 50 # max temperature for temperature warning
|
||||||
low_volt: 12 # min voltage for low voltage warning
|
low_volt: 12 # min voltage for low voltage warning
|
||||||
high_volt: 14.8 # max voltage for over voltage warning
|
high_volt: 14.8 # max voltage for over voltage warning
|
||||||
unclassified: 5 # min voltage samples not classified for warning
|
unclassified: 5 # min voltage samples not classified for warning
|
||||||
max_vm: [1.5, 2.5] # thresholds for mass offset (warn, fail)
|
max_vm: [1.5, 2.5] # thresholds for mass offset (warn, fail)
|
||||||
|
clockquality_warn: 90 # clock quality ranges from 0 % to 100 % with 100 % being the best level
|
||||||
|
clockquality_fail: 70
|
||||||
|
|
||||||
# ---------------------------------------- OPTIONAL PARAMETERS ---------------------------------------------------------
|
# ---------------------------------------- OPTIONAL PARAMETERS ---------------------------------------------------------
|
||||||
|
|
||||||
@ -70,7 +72,8 @@ channel_names: ["Temperature (°C)",
|
|||||||
"Logger (V)",
|
"Logger (V)",
|
||||||
"Mass 1 (V)",
|
"Mass 1 (V)",
|
||||||
"Mass 2 (V)",
|
"Mass 2 (V)",
|
||||||
"Mass 3 (V)"]
|
"Mass 3 (V)",
|
||||||
|
"Clock Q (%)"]
|
||||||
|
|
||||||
# specify y-ticks (and ylims) giving, (ymin, ymax, step) for each of the above channels (0: default)
|
# specify y-ticks (and ylims) giving, (ymin, ymax, step) for each of the above channels (0: default)
|
||||||
CHANNEL_TICKS:
|
CHANNEL_TICKS:
|
||||||
@ -81,6 +84,7 @@ CHANNEL_TICKS:
|
|||||||
- [-2, 2, 1]
|
- [-2, 2, 1]
|
||||||
- [-2, 2, 1]
|
- [-2, 2, 1]
|
||||||
- [-2, 2, 1]
|
- [-2, 2, 1]
|
||||||
|
- [0, 100, 20]
|
||||||
|
|
||||||
# Factor for channel to SI-units (for plotting)
|
# Factor for channel to SI-units (for plotting)
|
||||||
CHANNEL_UNITS:
|
CHANNEL_UNITS:
|
||||||
|
58
survBot.py
58
survBot.py
@ -61,7 +61,7 @@ def fancy_timestr(dt, thresh=600, modif='+'):
|
|||||||
|
|
||||||
class SurveillanceBot(object):
|
class SurveillanceBot(object):
|
||||||
def __init__(self, parameter_path, outpath_html=None):
|
def __init__(self, parameter_path, outpath_html=None):
|
||||||
self.keys = ['last active', '230V', '12V', 'router', 'charger', 'voltage', 'mass', 'temp', 'other']
|
self.keys = ['last active', '230V', '12V', 'router', 'charger', 'voltage', 'mass', 'clock', 'temp', 'other']
|
||||||
self.parameter_path = parameter_path
|
self.parameter_path = parameter_path
|
||||||
self.update_parameters()
|
self.update_parameters()
|
||||||
self.starttime = UTCDateTime()
|
self.starttime = UTCDateTime()
|
||||||
@ -686,6 +686,7 @@ class StationQC(object):
|
|||||||
self.pb_power_analysis()
|
self.pb_power_analysis()
|
||||||
self.pb_rout_charge_analysis()
|
self.pb_rout_charge_analysis()
|
||||||
self.mass_analysis()
|
self.mass_analysis()
|
||||||
|
self.clock_quality_analysis()
|
||||||
|
|
||||||
def return_print_analysis(self):
|
def return_print_analysis(self):
|
||||||
items = [self.nwst_id]
|
items = [self.nwst_id]
|
||||||
@ -714,6 +715,44 @@ class StationQC(object):
|
|||||||
def get_last_occurrence(self, trace, indices):
|
def get_last_occurrence(self, trace, indices):
|
||||||
return self.get_time(trace, indices[-1])
|
return self.get_time(trace, indices[-1])
|
||||||
|
|
||||||
|
def clock_quality_analysis(self, channel='LCQ'):
|
||||||
|
""" Analyse clock quality """
|
||||||
|
key = 'clock'
|
||||||
|
st = self.stream.select(channel=channel)
|
||||||
|
trace = self.get_trace(st, key)
|
||||||
|
if not trace: return
|
||||||
|
clockQuality = trace.data
|
||||||
|
clockQuality_warn_level = self.parameters.get('THRESHOLDS').get('clockquality_warn')
|
||||||
|
clockQuality_fail_level = self.parameters.get('THRESHOLDS').get('clockquality_fail')
|
||||||
|
|
||||||
|
if self.verbosity > 1:
|
||||||
|
self.print(40 * '-')
|
||||||
|
self.print('Performing Clock Quality check', flush=False)
|
||||||
|
|
||||||
|
clockQuality_warn = np.where(clockQuality < clockQuality_warn_level)[0]
|
||||||
|
clockQuality_fail = np.where(clockQuality < clockQuality_fail_level)[0]
|
||||||
|
|
||||||
|
if len(clockQuality_warn) == 0 and len(clockQuality_fail) == 0:
|
||||||
|
self.status_ok(key, detailed_message=f'ClockQuality={(clockQuality[-1])}')
|
||||||
|
return
|
||||||
|
|
||||||
|
warn_message = f'Trace {trace.get_id()}:'
|
||||||
|
if len(clockQuality_warn) > 0:
|
||||||
|
# try calculate number of warn peaks from gaps between indices
|
||||||
|
n_qc_warn = self.calc_occurrences(clockQuality_warn)
|
||||||
|
detailed_message = warn_message + f' {n_qc_warn}x Qlock Quality less then {clockQuality_warn_level}%' \
|
||||||
|
+ self.get_last_occurrence_timestring(trace, clockQuality_warn)
|
||||||
|
self.warn(key, detailed_message=detailed_message, count=n_qc_warn,
|
||||||
|
last_occurrence=self.get_last_occurrence(trace, clockQuality_warn))
|
||||||
|
|
||||||
|
if len(clockQuality_fail) > 0:
|
||||||
|
# try calculate number of fail peaks from gaps between indices
|
||||||
|
n_qc_fail = self.calc_occurrences(clockQuality_fail)
|
||||||
|
detailed_message = warn_message + f' {n_qc_fail}x Qlock Quality less then {clockQuality_fail_level}%' \
|
||||||
|
+ self.get_last_occurrence_timestring(trace, clockQuality_fail)
|
||||||
|
self.error(key, detailed_message=detailed_message, count=n_qc_fail,
|
||||||
|
last_occurrence=self.get_last_occurrence(trace, clockQuality_fail))
|
||||||
|
|
||||||
def voltage_analysis(self, channel='VEI'):
|
def voltage_analysis(self, channel='VEI'):
|
||||||
""" Analyse voltage channel for over/undervoltage """
|
""" Analyse voltage channel for over/undervoltage """
|
||||||
key = 'voltage'
|
key = 'voltage'
|
||||||
@ -1107,23 +1146,6 @@ class StatusOther(Status):
|
|||||||
return message, detailed_message
|
return message, detailed_message
|
||||||
|
|
||||||
|
|
||||||
def common_mass_trace(st):
|
|
||||||
traces = st.traces
|
|
||||||
if not len(traces) == 3:
|
|
||||||
return
|
|
||||||
check_keys = ['sampling_rate', 'starttime', 'endtime', 'npts']
|
|
||||||
# check if values of the above keys are identical for all traces
|
|
||||||
for c_key in check_keys:
|
|
||||||
if not traces[0].stats.get(c_key) == traces[1].stats.get(c_key) == traces[2].stats.get(c_key):
|
|
||||||
return
|
|
||||||
max_1_2 = np.fmax(abs(traces[0]), abs(traces[1]))
|
|
||||||
abs_max = np.fmax(max_1_2, abs(traces[2]))
|
|
||||||
return_trace = traces[0].copy()
|
|
||||||
return_trace.data = abs_max
|
|
||||||
return return_trace
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description='Call survBot')
|
parser = argparse.ArgumentParser(description='Call survBot')
|
||||||
parser.add_argument('-html', dest='html_path', default=None, help='filepath for HTML output')
|
parser.add_argument('-html', dest='html_path', default=None, help='filepath for HTML output')
|
||||||
|
Loading…
Reference in New Issue
Block a user