[GRASS-SVN] r70689 - grass/branches/releasebranch_7_2/imagery/i.zc

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 27 04:05:54 PST 2017


Author: mlennert
Date: 2017-02-27 04:05:54 -0800 (Mon, 27 Feb 2017)
New Revision: 70689

Modified:
   grass/branches/releasebranch_7_2/imagery/i.zc/main.c
Log:
i.zc: correctly read the threshold value, set to 1 by default and divided by 100 internally (backport from trunk, r70477 and r70688)


Modified: grass/branches/releasebranch_7_2/imagery/i.zc/main.c
===================================================================
--- grass/branches/releasebranch_7_2/imagery/i.zc/main.c	2017-02-27 12:01:45 UTC (rev 70688)
+++ grass/branches/releasebranch_7_2/imagery/i.zc/main.c	2017-02-27 12:05:54 UTC (rev 70689)
@@ -86,7 +86,7 @@
     threshold->required = NO;
     threshold->multiple = NO;
     threshold->description = _("Sensitivity of Gaussian filter");
-    threshold->answer = "10";
+    threshold->answer = "1.0";
 
     orientations = G_define_option();
     orientations->key = "orientations";
@@ -103,11 +103,15 @@
     /* open input cell map */
     inputfd = Rast_open_old(input_map->answer, "");
 
-    sscanf(threshold->answer, "%1lf", &Thresh);
+    Thresh = atof(threshold->answer);
     if (Thresh <= 0.0)
 	G_fatal_error(_("Threshold less than or equal to zero not allowed"));
-    Thresh /= 100.0;
+    /* A threshold value of 0.01 seems to give fairly good results on average.  */
+    /* So we divide the threshold by 100 to get a value of 0.01 for the default */ 
+    /* parameter value = 1. */
 
+    Thresh = Thresh / 100.0;
+
     sscanf(width->answer, "%f", &Width);
 
     if (Width <= 0.0)



More information about the grass-commit mailing list