mirror of
https://github.com/FAUSheppy/ths-datenlogger
synced 2025-12-08 12:48:32 +01:00
add error handling and special cases for large chunks of missing outside data
This commit is contained in:
@@ -34,16 +34,27 @@ def __plot(tup, datapoints, path, date1=None, date2=None, forcePath=False, qtTex
|
|||||||
|
|
||||||
# generate datapoints #
|
# generate datapoints #
|
||||||
tupelsToIterate = []
|
tupelsToIterate = []
|
||||||
|
makeLast = None
|
||||||
for key in datapoints.keys():
|
for key in datapoints.keys():
|
||||||
g = datapoints[key]
|
g = datapoints[key]
|
||||||
if not g.plot:
|
if not g.plot:
|
||||||
continue
|
continue
|
||||||
x,y, = g.get_timeframe(tup[CALLBACK],date1,date2)
|
x,y, = g.get_timeframe(tup[CALLBACK],date1,date2)
|
||||||
|
|
||||||
|
# ensure a native value is last in the list to fix unix_x last tick #
|
||||||
|
if not makeLast and (g.name == CFG("plot_temperatur_key") or CFG("plot_humidity_key")):
|
||||||
|
makeLast = (x, y, g)
|
||||||
|
else:
|
||||||
tupelsToIterate += [(x, y, g)]
|
tupelsToIterate += [(x, y, g)]
|
||||||
|
|
||||||
|
tupelsToIterate += [makeLast]
|
||||||
|
|
||||||
# check for negative values (legend padding) #
|
# check for negative values (legend padding) #
|
||||||
anyValueNegative = False
|
anyValueNegative = False
|
||||||
for x, y, g in tupelsToIterate:
|
for x, y, g in tupelsToIterate:
|
||||||
|
if not y or len(y) == 0:
|
||||||
|
qtTextBrowser.append("leere Sequenz für {}, y: {}, x: {}".format(g.name, y, x))
|
||||||
|
raise ValueError("leere Sequenz für {}, y: {}, x: {}".format(g.name, y, x))
|
||||||
anyValueNegative = anyValueNegative or min(y) < 0
|
anyValueNegative = anyValueNegative or min(y) < 0
|
||||||
|
|
||||||
# plot #
|
# plot #
|
||||||
|
|||||||
Reference in New Issue
Block a user