[GRASS-SVN] r69202 - grass-addons/grass7/imagery/i.segment.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 22 03:31:37 PDT 2016


Author: mlennert
Date: 2016-08-22 03:31:36 -0700 (Mon, 22 Aug 2016)
New Revision: 69202

Modified:
   grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
Log:
i.segment.stats: added separator parameter & check whether r.object.geometry is installed


Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py	2016-08-22 09:22:13 UTC (rev 69201)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py	2016-08-22 10:31:36 UTC (rev 69202)
@@ -60,6 +60,9 @@
 #% required: no
 #% guisection: output
 #%end
+#%option G_OPT_F_SEP
+#% guisection: output
+#%end
 #% option G_OPT_V_OUTPUT
 #% key: vectormap
 #% label: Optional vector output map with statistics as attributes
@@ -105,12 +108,14 @@
     r_object_geometry = True
     if area_measures:
 	if not gscript.find_program('r.object.geometry', '--help'):
-		message = _("You need to install the addon 'r.object.geometry' to be able")
-		message += _(" to calculate area measures. Ignoring these measures for now")
+		message = _("You need to install the addon r.object.geometry to be able")
+		message += _(" to calculate area measures. Ignoring these measures for now.")
+		message += _(" You can install the addon with 'g.extension r.object.geometry'")
 		gscript.warning(message)
 		r_object_geometry = False
 
     raster_statistics = options['raster_statistics'].split(',') if options['raster_statistics'] else []
+    separator = gscript.separator(options['separator'])
 
     output_header = ['cat']
     output_dict = collections.defaultdict(list)
@@ -191,10 +196,10 @@
 
     if csvfile:
         with open(csvfile, 'wb') as f:
-            f.write(",".join(output_header)+"\n")
+            f.write(separator.join(output_header)+"\n")
             for key in output_dict:
 		if len(output_dict[key]) + 1 == len(output_header):
-                    f.write(key+","+",".join(output_dict[key])+"\n")
+                    f.write(key+separator+separator.join(output_dict[key])+"\n")
 		else:
 		    error_objects.append(key)
         f.close()



More information about the grass-commit mailing list