dt = Today()
return dt - datetime.timedelta(days=1)
+def Prehistoric():
+ dt = datetime.date(2000,01,01)
+ return dt
+
def GetData(sid,pid,fromDate=Yesterday(),toDate=Today()):
if database:
c = database.cursor()
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"
def ProcessTable(sid,pid):
- if not current:
+ if process_all:
+ data=GetData(sid,pid,Prehistoric(),Today())
+ elif not current:
data=GetData(sid,pid)
else:
data=GetData(sid,pid,Today(),Tomorrow())
+
+ if not data:
+ return
+
sID=[]
sTime=[]
sValue=[]
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])
else:
current=False
+if len(sys.argv)==2 and sys.argv[1]=='all':
+ process_all=True
+else:
+ process_all=False
try: