[GRASS-SVN] r58154 - grass/trunk/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 6 05:17:27 PST 2013


Author: lucadelu
Date: 2013-11-06 05:17:27 -0800 (Wed, 06 Nov 2013)
New Revision: 58154

Modified:
   grass/trunk/lib/python/temporal/univar_statistics.py
Log:
replace print with string variable and only at the end print the string

Modified: grass/trunk/lib/python/temporal/univar_statistics.py
===================================================================
--- grass/trunk/lib/python/temporal/univar_statistics.py	2013-11-06 12:44:00 UTC (rev 58153)
+++ grass/trunk/lib/python/temporal/univar_statistics.py	2013-11-06 13:17:27 UTC (rev 58154)
@@ -57,18 +57,19 @@
                      'sp': sp.get_new_map_instance(None).get_type(), 'i': id})
 
     if header == True:
-        print "id" + fs + "start" + fs + "end" + fs + "mean" + fs + \
-            "min" + fs + "max" + fs,
-        print "mean_of_abs" + fs + "stddev" + fs + "variance" + fs,
+        string = ""
+        string += "id" + fs + "start" + fs + "end" + fs + "mean" + fs
+        string += "min" + fs + "max" + fs
+        string += "mean_of_abs" + fs + "stddev" + fs + "variance" + fs
+        string += "coeff_var" + fs + "sum" + fs + "null_cells" + fs + "cells"
         if extended == True:
-            print "coeff_var" + fs + "sum" + fs + \
-                "null_cells" + fs + "cells" + fs,
-            print "first_quartile" + fs + "median" + fs + \
-                "third_quartile" + fs + "percentile_90"
-        else:
-            print "coeff_var" + fs + "sum" + fs + "null_cells" + fs + "cells"
+            string += "first_quartile" + fs + "median" + fs
+            string += "third_quartile" + fs + "percentile_90"
 
+        print string
+
     for row in rows:
+        string = ""
         id = row["id"]
         start = row["start_time"]
         end = row["end_time"]
@@ -83,21 +84,17 @@
         elif type == "str3ds":
             stats = core.parse_command("r3.univar", map=id, flags=flag)
 
-        print str(id) + fs + str(start) + fs + str(end),
-        print fs + str(stats["mean"]) + fs + str(stats["min"]) + \
-            fs + str(stats["max"]) + fs + str(stats["mean_of_abs"]),
-        print fs + str(stats["stddev"]) + fs + str(stats["variance"]) + \
-            fs + str(stats["coeff_var"]) + fs + str(stats["sum"]),
+        string += str(id) + fs + str(start) + fs + str(end)
+        string += fs + str(stats["mean"]) + fs + str(stats["min"])
+        string += fs + str(stats["max"]) + fs + str(stats["mean_of_abs"])
+        string += fs + str(stats["stddev"]) + fs + str(stats["variance"])
+        string += fs + str(stats["coeff_var"]) + fs + str(stats["sum"])
+        string += fs + str(stats["null_cells"]) + fs + str(stats["cells"]) + fs
+        if extended == True:            
+            string += str(stats["first_quartile"]) + fs + str(stats["median"])
+            string += fs + str(stats["third_quartile"]) + fs + str(stats["percentile_90"])
+        print string
 
-        if extended == True:
-            print fs + str(stats["null_cells"]) + fs + str(
-                stats["cells"]) + fs,
-            print str(stats["first_quartile"]) + fs + str(stats["median"]) + \
-                  fs + str(stats["third_quartile"]) + \
-                  fs + str(stats["percentile_90"])
-        else:
-            print fs + str(stats["null_cells"]) + fs + str(stats["cells"])
-
     dbif.close()
 
 ###############################################################################



More information about the grass-commit mailing list