[GRASS-SVN] r65496 - grass-addons/grass7/vector/v.concave.hull
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 17 06:53:52 PDT 2015
Author: mlennert
Date: 2015-06-17 06:53:52 -0700 (Wed, 17 Jun 2015)
New Revision: 65496
Modified:
grass-addons/grass7/vector/v.concave.hull/v.concave.hull.py
Log:
automatically reduce threshold if too high
Modified: grass-addons/grass7/vector/v.concave.hull/v.concave.hull.py
===================================================================
--- grass-addons/grass7/vector/v.concave.hull/v.concave.hull.py 2015-06-17 11:01:05 UTC (rev 65495)
+++ grass-addons/grass7/vector/v.concave.hull/v.concave.hull.py 2015-06-17 13:53:52 UTC (rev 65496)
@@ -128,6 +128,19 @@
max_length = 0.0
sortfile(tmp, tmp + ".sort")
ppos = round(N * perc / 100)
+
+ perc_orig = perc
+ while ppos >= N and perc >= 90:
+ perc -= 1
+ ppos = round(N * perc / 100)
+
+ if perc == 89:
+ grass.fatal(_("Cannot calculate hull. Too few points."))
+
+ if perc_orig > perc:
+ thresh = int(perc) - 90
+ grass.warning(_('Threshold reduced to %d to calculate hull' % thresh ))
+
inf = file(tmp + ".sort")
l = 0
for line in inf:
@@ -137,9 +150,6 @@
l += 1
inf.close()
- if max_length == 0.0:
- grass.fatal(_("Cannot calculate hull. Try lowering the threshold."))
-
grass.message(_("Feature selection..."))
lines_concave = prefix + '_delaunay_lines_select'
lines_concave_nocat = prefix + '_delaunay_lines_select_nocat'
More information about the grass-commit
mailing list