Compare commits

..

3 Commits

Author SHA1 Message Date
353f073d12 [update] added color palette suggested by AM, some visual tweaks 2023-04-21 16:33:02 +02:00
10e2322882 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	utils.py
2023-04-21 14:17:28 +02:00
72e3ede52f [minor] small adjustments 2023-04-20 15:41:20 +02:00
4 changed files with 25 additions and 27 deletions

View File

@ -128,7 +128,7 @@ add_global_links:
- {"text": "show recent events on map",
"URL": "https://fdsnws.geophysik.ruhr-uni-bochum.de/map/?lat=39.5&lon=21&zoom=7&baselayer=mapnik"}
# html logo at page bottom
# html logo at page bottom (path relative to html directory)
html_logo: "figures/Logo_RUB_BLAU_rgb.png"
# E-mail notifications

View File

@ -504,12 +504,21 @@ class SurveillanceBot(object):
outfile.write(finish_html_table())
# add optional links below html table
for dct in self.add_global_links:
link_str = get_html_link(dct.get('text'), dct.get('URL'))
outfile.write(get_html_text(link_str))
# add status message
outfile.write(get_html_text(self.status_message))
outfile.write(html_footer(footer_logo=self.parameters.get('html_logo')))
# write footer with optional logo
logo_file = self.parameters.get('html_logo')
if not os.path.isfile(pjoin(self.outpath_html, logo_file)):
print(f'Specified file {logo_file} not found.')
logo_file = None
outfile.write(html_footer(footer_logo=logo_file))
except Exception as e:
print(f'Could not write HTML table to {fnout}:')

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import partial
import matplotlib
import numpy as np
@ -36,17 +34,17 @@ def get_bg_color(check_key, status, dt_thresh=None, hex=False):
def get_color(key):
# some GUI default colors
# colors_dict = {'FAIL': (255, 50, 0, 255),
# some old GUI default colors
# colors_dict = {'FAIL': (255, 85, 50, 255),
# 'NO DATA': (255, 255, 125, 255),
# 'WARN': (255, 255, 80, 255),
# 'OK': (125, 255, 125, 255),
# 'OK': (173, 255, 133, 255),
# 'undefined': (230, 230, 230, 255),
# 'disc': (255, 160, 40, 255),}
colors_dict = {'FAIL': (195, 29, 14, 255),
'NO DATA': (255, 255, 125, 255),
'WARN': (249, 238, 139, 255),
'OK': (179, 219, 153, 255),
'WARN': (250, 192, 63, 255),
'OK': (185, 245, 145, 255),
'undefined': (240, 240, 240, 255),
'disc': (126, 127, 131, 255), }
return colors_dict.get(key)
@ -67,18 +65,11 @@ def get_time_delay_color(dt, dt_thresh):
return get_color('FAIL')
def get_warn_color(count):
n_colors = 20
# r = np.linspace(158, 255, n_colors, dtype=int)
# g = np.linspace(255, 255, n_colors, dtype=int)
# b = np.linspace(114, 80, n_colors, dtype=int)
r = np.linspace(204, 249, n_colors, dtype=int)
g = np.linspace(226, 238, n_colors, dtype=int)
b = np.linspace(149, 139, n_colors, dtype=int)
pad = partial(np.pad, pad_width=(0, 100), mode='edge')
r, g, b = map(pad, [r, g, b])
color = (r[count], g[count], b[count], 255)
return color
def get_warn_color(count, n_colors=20):
if count > n_colors:
count = -1
gradient = np.linspace((240, 245, 110, 255), (250, 192, 63, 255), n_colors, dtype=int)
return tuple(gradient[count])
def get_mass_color(message):
@ -254,4 +245,4 @@ def plot_threshold_lines(fig, channel_threshold_list, parameters, **kwargs):
if isinstance(warn_thresh, str):
warn_thresh = parameters.get('THRESHOLDS').get(warn_thresh)
if type(warn_thresh in (float, int)):
ax.axhline(warn_thresh, **kwargs)
ax.axhline(warn_thresh, **kwargs)

View File

@ -40,11 +40,11 @@ def get_mail_html_header():
def init_html_table():
return '<div id="managerTable" ><table style="width:100%">\n'
return '<table style="width:100%">\n'
def finish_html_table():
return '</table></div>\n'
return '</table>\n'
def html_footer(footer_logo=None):
@ -79,11 +79,9 @@ def get_html_row(items, html_key='td'):
if item.get('italic'):
text = '<i>' + text + '</i>'
tooltip = item.get('tooltip')
color = item.get('color')
# check for black background of headers (shouldnt happen anymore)
color = '#e6e6e6' if color == '#000000' else color
font_color = item.get('font_color')
hyperlink = item.get('hyperlink')
color = 'transparent' if hyperlink else item.get('color')
text_str = get_html_link(text, hyperlink) if hyperlink else text
html_class = item.get('html_class')
class_str = f' class="{html_class}"' if html_class else ''