From e83dc3feca9943d316083ca80ea0920056d0e759 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Tue, 27 Sep 2016 15:38:49 +0300 Subject: [PATCH] =?utf8?q?=D0=9D=D0=B5=20=D1=80=D1=83=D0=B3=D0=B0=D0=B5?= =?utf8?q?=D0=BC=D1=81=D1=8F=20=D0=BD=D0=B0=20=D0=BF=D1=83=D1=81=D1=82?= =?utf8?q?=D1=8B=D0=B5=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- filter_meteo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 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]) -- 2.34.1