[GRASS-SVN] r44965 - grass/trunk/scripts/v.db.univar
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 11 13:35:48 EST 2011
Author: mmetz
Date: 2011-01-11 10:35:47 -0800 (Tue, 11 Jan 2011)
New Revision: 44965
Modified:
grass/trunk/scripts/v.db.univar/v.db.univar.py
Log:
fix for special cases
Modified: grass/trunk/scripts/v.db.univar/v.db.univar.py
===================================================================
--- grass/trunk/scripts/v.db.univar/v.db.univar.py 2011-01-11 18:34:06 UTC (rev 44964)
+++ grass/trunk/scripts/v.db.univar/v.db.univar.py 2011-01-11 18:35:47 UTC (rev 44965)
@@ -158,6 +158,8 @@
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 @@
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")
More information about the grass-commit
mailing list