[GRASS-SVN] r69999 - grass/branches/releasebranch_7_2/lib/python/temporal

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 4 14:49:16 PST 2016


Author: martinl
Date: 2016-12-04 14:49:16 -0800 (Sun, 04 Dec 2016)
New Revision: 69999

Modified:
   grass/branches/releasebranch_7_2/lib/python/temporal/mapcalc.py
Log:
libtemporal: simplify percent() calls in dataset_mapcalculator() (merge r69998 from trunk)

Modified: grass/branches/releasebranch_7_2/lib/python/temporal/mapcalc.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/temporal/mapcalc.py	2016-12-04 22:46:06 UTC (rev 69998)
+++ grass/branches/releasebranch_7_2/lib/python/temporal/mapcalc.py	2016-12-04 22:49:16 UTC (rev 69999)
@@ -119,7 +119,7 @@
                                              dbif=dbif)
 
             # In case samples are not found
-            if not list and len(list) == 0:
+            if not list or len(list) == 0:
                 dbif.close()
                 msgr.message(_("No samples found for map calculation"))
                 return 0
@@ -196,8 +196,7 @@
         for i in range(num):
 
             count += 1
-            if count % 10 == 0:
-                msgr.percent(count, num, 1)
+            msgr.percent(count, num, 10)
 
             # Create the r.mapcalc statement for the current time step
             map_name = "{base}_{suffix}".format(base=base,
@@ -294,8 +293,7 @@
         for new_map in map_list:
 
             count += 1
-            if count % 10 == 0:
-                msgr.percent(count, num, 1)
+            msgr.percent(count, num, 10)
 
             # Read the map data
             new_map.load()
@@ -315,8 +313,6 @@
         # Update the spatio-temporal extent and the metadata table entries
         new_sp.update_from_registered_maps(dbif)
 
-        msgr.percent(1, 1, 1)
-
         # Remove empty maps
         if len(empty_maps) > 0:
             names = ""



More information about the grass-commit mailing list