[minor] fixed some typos and missing import
This commit is contained in:
parent
a6c1570539
commit
b986da5fef
34
README.md
34
README.md
@ -3,7 +3,7 @@
|
|||||||
version: 0.2
|
version: 0.2
|
||||||
|
|
||||||
survBot is a small program used to track station quality channels of DSEBRA stations via PowBox output over SOH channels
|
survBot is a small program used to track station quality channels of DSEBRA stations via PowBox output over SOH channels
|
||||||
by analysing contents of a Seiscomp3 datapath.
|
by analyzing contents of a Seiscomp data archive.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -60,33 +60,33 @@ The directory `/path/to/conf-dir` should contain the `parameters.yaml` file, and
|
|||||||
|
|
||||||
The e-mail server settings can be configured in the `parameters.yaml` file. The following settings are available:
|
The e-mail server settings can be configured in the `parameters.yaml` file. The following settings are available:
|
||||||
|
|
||||||
- `mailserver`: the address of the mail server
|
* `mailserver`: the address of the mail server
|
||||||
- `auth_type`: the authentication type for the mail server (`None`, `SSL`, `TLS`)
|
* `auth_type`: the authentication type for the mail server (`None`, `SSL`, `TLS`)
|
||||||
- `port`: the port of the mail server
|
* `port`: the port of the mail server
|
||||||
- `user`: the username for the mail server (if required)
|
* `user`: the username for the mail server (if required)
|
||||||
- `password`: the password for the mail server (if required)
|
* `password`: the password for the mail server (if required)
|
||||||
|
|
||||||
The `user` and `password` fields are optional, and can be left empty if the mail server does not require authentication. The `auth_type` field can be set to `None` if no authentication is required, `SSL` if the mail server requires SSL authentication, or `TLS` if the mail server requires TLS authentication. If the `user` or `password` fileds are set to `Docker` ore `ENV` the program will try to read the values from the docker secrets `mail_user` and `mail_password` or environment variables `MAIL_USER` and `MAIL_PASSWORD` respectively. Docker secrets are only available in Docker Swarm mode, i.e. if the program is run as a service.
|
The `user` and `password` fields are optional, and can be left empty if the mail server does not require authentication. The `auth_type` field can be set to `None` if no authentication is required, `SSL` if the mail server requires SSL authentication, or `TLS` if the mail server requires TLS authentication. If the `user` or `password` fields are set to `Docker` ore `ENV` the program will try to read the values from the docker secrets `mail_user` and `mail_password` or environment variables `MAIL_USER` and `MAIL_PASSWORD` respectively. Docker secrets are only available in Docker Swarm mode, i.e. if the program is run as a service.
|
||||||
|
|
||||||
## Version Changes
|
## Version Changes
|
||||||
|
|
||||||
### 0.2
|
### 0.2
|
||||||
|
|
||||||
- surveillance of mass, clock and gaps
|
* surveillance of mass, clock and gaps
|
||||||
- individual mailing lists for different stations
|
* individual mailing lists for different stations
|
||||||
- html mail with recent status information
|
* html mail with recent status information
|
||||||
- updated web page design
|
* updated web page design
|
||||||
- restructured parameter file
|
* restructured parameter file
|
||||||
- recognize if PBox is disconnected
|
* recognize if PBox is disconnected
|
||||||
|
|
||||||
### 0.2-docker
|
### 0.2-docker
|
||||||
|
|
||||||
- added Dockerfile for easy deployment
|
* added Dockerfile for easy deployment
|
||||||
- added more settings for connection to a mail server
|
* added more settings for connection to a mail server
|
||||||
|
|
||||||
## Staff
|
## Staff
|
||||||
|
|
||||||
Original author: M.Paffrath (marcel.paffrath@rub.de)
|
Original author: M.Paffrath (<marcel.paffrath@rub.de>)
|
||||||
Contributions by: Kasper D. Fischer (kasper.fischer@rub.de)
|
Contributions: Kasper D. Fischer (<kasper.fischer@rub.de>)
|
||||||
|
|
||||||
Jan 2025
|
Jan 2025
|
||||||
|
18
survBot.py
18
survBot.py
@ -234,7 +234,7 @@ class SurveillanceBot(object):
|
|||||||
self.gaps = self.dataStream.get_gaps(min_gap=self.parameters['THRESHOLDS'].get('min_gap'))
|
self.gaps = self.dataStream.get_gaps(min_gap=self.parameters['THRESHOLDS'].get('min_gap'))
|
||||||
self.dataStream.merge()
|
self.dataStream.merge()
|
||||||
|
|
||||||
# organise data in dictionary with key for each station
|
# organize data in dictionary with key for each station
|
||||||
for trace in self.dataStream:
|
for trace in self.dataStream:
|
||||||
nwst_id = get_nwst_id(trace)
|
nwst_id = get_nwst_id(trace)
|
||||||
if not nwst_id in self.data.keys():
|
if not nwst_id in self.data.keys():
|
||||||
@ -351,7 +351,7 @@ class SurveillanceBot(object):
|
|||||||
first_exec = False
|
first_exec = False
|
||||||
|
|
||||||
def console_print(self, itemlist, str_len=21, sep='|', seplen=3):
|
def console_print(self, itemlist, str_len=21, sep='|', seplen=3):
|
||||||
assert len(sep) <= seplen, f'Make sure seperator has less than {seplen} characters'
|
assert len(sep) <= seplen, f'Make sure separator has less than {seplen} characters'
|
||||||
sl = sep.ljust(seplen)
|
sl = sep.ljust(seplen)
|
||||||
sr = sep.rjust(seplen)
|
sr = sep.rjust(seplen)
|
||||||
string = sl
|
string = sl
|
||||||
@ -1299,7 +1299,7 @@ class StationQC(object):
|
|||||||
|
|
||||||
# Warn in case of voltage under OK-level (1V)
|
# Warn in case of voltage under OK-level (1V)
|
||||||
if len(under) > 0:
|
if len(under) > 0:
|
||||||
# try calculate number of occurences from gaps between indices
|
# try calculate number of occurrences from gaps between indices
|
||||||
n_occurrences = len(np.where(np.diff(under) > 1)[0]) + 1
|
n_occurrences = len(np.where(np.diff(under) > 1)[0]) + 1
|
||||||
voltage_dict[-1] = under
|
voltage_dict[-1] = under
|
||||||
self.status_other(detailed_message=f'Trace {trace.get_id()}: '
|
self.status_other(detailed_message=f'Trace {trace.get_id()}: '
|
||||||
@ -1395,15 +1395,15 @@ class StatusOK(Status):
|
|||||||
|
|
||||||
|
|
||||||
class StatusWarn(Status):
|
class StatusWarn(Status):
|
||||||
def __init__(self, message='WARN', count=1, last_occurence=None, detailed_messages=None, show_count=False):
|
def __init__(self, message='WARN', count=1, last_occurrence=None, detailed_messages=None, show_count=False):
|
||||||
super(StatusWarn, self).__init__(message=message, count=count, last_occurrence=last_occurence,
|
super(StatusWarn, self).__init__(message=message, count=count, last_occurrence=last_occurrence,
|
||||||
detailed_messages=detailed_messages, show_count=show_count)
|
detailed_messages=detailed_messages, show_count=show_count)
|
||||||
self.set_warn()
|
self.set_warn()
|
||||||
|
|
||||||
|
|
||||||
class StatusError(Status):
|
class StatusError(Status):
|
||||||
def __init__(self, message='FAIL', count=1, last_occurence=None, detailed_messages=None, show_count=False):
|
def __init__(self, message='FAIL', count=1, last_occurrence=None, detailed_messages=None, show_count=False):
|
||||||
super(StatusError, self).__init__(message=message, count=count, last_occurrence=last_occurence,
|
super(StatusError, self).__init__(message=message, count=count, last_occurrence=last_occurrence,
|
||||||
detailed_messages=detailed_messages, show_count=show_count)
|
detailed_messages=detailed_messages, show_count=show_count)
|
||||||
self.set_error()
|
self.set_error()
|
||||||
self.default_message = message
|
self.default_message = message
|
||||||
@ -1420,8 +1420,8 @@ class StatusError(Status):
|
|||||||
|
|
||||||
|
|
||||||
class StatusOther(Status):
|
class StatusOther(Status):
|
||||||
def __init__(self, messages=None, count=1, last_occurence=None, detailed_messages=None):
|
def __init__(self, messages=None, count=1, last_occurrence=None, detailed_messages=None):
|
||||||
super(StatusOther, self).__init__(count=count, last_occurrence=last_occurence,
|
super(StatusOther, self).__init__(count=count, last_occurrence=last_occurrence,
|
||||||
detailed_messages=detailed_messages)
|
detailed_messages=detailed_messages)
|
||||||
if messages is None:
|
if messages is None:
|
||||||
messages = []
|
messages = []
|
||||||
|
3
utils.py
3
utils.py
@ -6,6 +6,7 @@ import logging
|
|||||||
import matplotlib
|
import matplotlib
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import os
|
||||||
|
|
||||||
from obspy import Stream
|
from obspy import Stream
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ def transform_trace(data, transf):
|
|||||||
elif operator_str == '/':
|
elif operator_str == '/':
|
||||||
data = data / val
|
data = data / val
|
||||||
else:
|
else:
|
||||||
raise IOError(f'Unknown arithmethic operator string: {operator_str}')
|
raise IOError(f'Unknown arithmetic operator string: {operator_str}')
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user