imprv: add additional info output for broken data & timeframes in qtb

This commit is contained in:
2024-03-05 21:32:46 +01:00
parent c01239886b
commit 3b256bd878
2 changed files with 6 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ def cache_content(from_time, to_time, data, dtype):
return return_string
def generate(master_dir, from_time, to_time, cache_file, dtype):
def generate(master_dir, from_time, to_time, cache_file, dtype, qt_text_browser):
timeframes = []
@@ -75,6 +75,9 @@ def generate(master_dir, from_time, to_time, cache_file, dtype):
# skip shit data #
if float(temp) < -100 or float(hum) < 0:
wtext = "WARNING: Skipping broken DWD data @{} (hum: {}, temp: {}".format(
date, hum, temp)
qt_text_browser.append(wtext)
continue
# append data #
@@ -88,6 +91,7 @@ def generate(master_dir, from_time, to_time, cache_file, dtype):
# save values #
timeframes.append((start, end, data))
qt_text_browser.append("INFO: FILE: {}, START: {}, END: {}".format(fname, start, end))
info_for_output_if_error.append("{}\n{} bis {}".format(fname, start, end))
# find a fitting frame #

View File

@@ -132,7 +132,7 @@ def processExternalData(datapoints, plotNameKey, fromTime, toTime, dtype, qtText
if r.status_code != 200 or "nicht gefunden" in r.text.lower():
qtTextBrowser.append(de.failed_to_retrieve.format("NOT FOUND"))
qtTextBrowser.append("Versuche von DWD-Datei zu laden - Dass kann einen Moment dauern")
content = fallback_csv.generate(CFG("dwd_dir"), fromTime, toTime, cacheFile, dtype)
content = fallback_csv.generate(CFG("dwd_dir"), fromTime, toTime, cacheFile, dtype, qtTextBrowser)
else:
qtTextBrowser.append(de.pg_request.format(url))
content = r.content.decode('utf-8', "ignore") # ignore bad bytes