projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b7dcd29
)
Не ругаемся на пустые выборки
author
Roman Bazalevsky
<rvb@rvb.name>
Tue, 27 Sep 2016 12:38:49 +0000
(15:38 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Tue, 27 Sep 2016 12:38:49 +0000
(15:38 +0300)
filter_meteo.py
[changed mode: 0644->0755]
patch
|
blob
|
history
diff --git
a/filter_meteo.py
b/filter_meteo.py
old mode 100644
(file)
new mode 100755
(executable)
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)
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"
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())
data=GetData(sid,pid)
else:
data=GetData(sid,pid,Today(),Tomorrow())
+
+ if not data:
+ return
+
sID=[]
sTime=[]
sValue=[]
sID=[]
sTime=[]
sValue=[]
@@
-75,8
+78,6
@@
def ProcessTable(sid,pid):
avg=np.mean(sValueDiff)
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])
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])