浏览代码

fix for special cases

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44965 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 14 年之前
父节点
当前提交
4c92c8a1f3
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      scripts/v.db.univar/v.db.univar.py

+ 10 - 0
scripts/v.db.univar/v.db.univar.py

@@ -158,6 +158,8 @@ def main():
 
     tmpf = file(tmp)
     for line in tmpf:
+	if len(line.rstrip('\r\n')) == 0:
+	    continue
         x = float(line.rstrip('\r\n'))
         N += 1
         sum += x
@@ -207,14 +209,22 @@ def main():
     eostr = ['even','odd'][odd]
 
     q25pos = round(N * 0.25)
+    if q25pos == 0:
+	q25pos = 1
     q50apos = round(N * 0.50)
+    if q50apos == 0:
+	q50apos = 1
     q50bpos = q50apos + (1 - odd)
     q75pos = round(N * 0.75)
+    if q75pos == 0:
+	q75pos = 1
 
     ppos = {}
     pval = {}
     for i in range(len(perc)):
         ppos[i] = round(N * perc[i] / 100)
+	if ppos[i] == 0:
+	    ppos[i] = 1
         pval[i] = 0
 
     inf = file(tmp + ".sort")