X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/b7dcd298e5f0565be8e5ca3d9477cb6de97ae3ac..e83dc3feca9943d316083ca80ea0920056d0e759:/filter_meteo.py diff --git a/filter_meteo.py b/filter_meteo.py old mode 100644 new mode 100755 index b20dc41..d4f0e7d --- a/filter_meteo.py +++ b/filter_meteo.py @@ -48,7 +48,6 @@ def FixRecord(id,value): if database: c = database.cursor() command="UPDATE sensor_values SET value={} WHERE id='{}'".format(value,id) - print command c.execute(command) else: print "No connection to DB" @@ -60,6 +59,10 @@ def ProcessTable(sid,pid): data=GetData(sid,pid) else: data=GetData(sid,pid,Today(),Tomorrow()) + + if not data: + return + sID=[] sTime=[] sValue=[] @@ -75,8 +78,6 @@ def ProcessTable(sid,pid): avg=np.mean(sValueDiff) - print "Average="+str(avg) - for i in range(0,len(sTime)-1): if sValueDiff[i]>avg*filterThreshold: print "fixing %s : %5.2f %5.2f %5.2f" % (sTime[i],sValue[i],sValueFilt[i],sValueDiff[i])