[GRASS-SVN] r74100 - in grass/trunk: gui/wxpython/nviz temporal/t.rast.accdetect tools

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 17 12:38:08 PST 2019


Author: annakrat
Date: 2019-02-17 12:38:08 -0800 (Sun, 17 Feb 2019)
New Revision: 74100

Modified:
   grass/trunk/gui/wxpython/nviz/wxnviz.py
   grass/trunk/temporal/t.rast.accdetect/t.rast.accdetect.py
   grass/trunk/tools/ppmrotate.py
Log:
remove active usages of python xrange which was removed in Python 3

Modified: grass/trunk/gui/wxpython/nviz/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/wxnviz.py	2019-02-17 20:13:19 UTC (rev 74099)
+++ grass/trunk/gui/wxpython/nviz/wxnviz.py	2019-02-17 20:38:08 UTC (rev 74100)
@@ -836,7 +836,7 @@
         else:
             nsurfs = c_int()
             surf_list = GS_get_surf_list(byref(nsurfs))
-            for i in xrange(nsurfs.value):
+            for i in range(nsurfs.value):
                 id = surf_list[i]
                 GS_set_wire_color(id, color)
 

Modified: grass/trunk/temporal/t.rast.accdetect/t.rast.accdetect.py
===================================================================
--- grass/trunk/temporal/t.rast.accdetect/t.rast.accdetect.py	2019-02-17 20:13:19 UTC (rev 74099)
+++ grass/trunk/temporal/t.rast.accdetect/t.rast.accdetect.py	2019-02-17 20:38:08 UTC (rev 74100)
@@ -156,7 +156,7 @@
     minimum = options["minimum"]
     maximum = options["maximum"]
     occurrence = options["occurrence"]
-    range = options["range"]
+    range_ = options["range"]
     indicator = options["indicator"]
     staend = options["staend"]
     register_null = flags["n"]
@@ -191,7 +191,7 @@
     # The occurrence space time raster dataset
     if occurrence:
         if not minimum or not maximum:
-            if not range:
+            if not range_:
                 dbif.close()
                 grass.fatal(_("You need to set the range to compute the occurrence"
                               " space time raster dataset"))
@@ -320,7 +320,7 @@
 
         count = compute_occurrence(occurrence_maps, input_strds, input_maps,
                                    start, base, count, time_suffix, mapset,
-                                   where, reverse, range, minimum_strds,
+                                   where, reverse, range_, minimum_strds,
                                    maximum_strds, dbif)
 
         # Indicator computation is based on the occurrence so we need to start it after
@@ -327,7 +327,7 @@
         # the occurrence cycle
         if indicator:
             num_maps = len(input_maps)
-            for i in xrange(num_maps):
+            for i in range(num_maps):
                 if reverse:
                     map = input_maps[num_maps - i - 1]
                 else:
@@ -492,7 +492,7 @@
 ############################################################################
 
 def compute_occurrence(occurrence_maps, input_strds, input_maps, start, base,
-                       count, tsuffix, mapset, where, reverse, range,
+                       count, tsuffix, mapset, where, reverse, range_,
                        minimum_strds, maximum_strds, dbif):
 
     if minimum_strds:
@@ -511,7 +511,7 @@
 
     # Aggregate
     num_maps = len(input_maps)
-    for i in xrange(num_maps):
+    for i in range(num_maps):
         if reverse:
             map = input_maps[num_maps - i - 1]
         else:
@@ -550,7 +550,7 @@
                              " database, use overwrite flag to overwrite.") %
                             (occurrence_map.get_map_id()))
 
-        range_vals = range.split(",")
+        range_vals = range_.split(",")
         min = range_vals[0]
         max = range_vals[1]
 

Modified: grass/trunk/tools/ppmrotate.py
===================================================================
--- grass/trunk/tools/ppmrotate.py	2019-02-17 20:13:19 UTC (rev 74099)
+++ grass/trunk/tools/ppmrotate.py	2019-02-17 20:38:08 UTC (rev 74100)
@@ -68,9 +68,9 @@
 
 def rotate_ppm(srcd):
     dstd = array.array('B', len(srcd) * '\0')
-    for y in xrange(height):
-        for x in xrange(width):
-            for c in xrange(3):
+    for y in range(height):
+        for x in range(width):
+            for c in range(3):
                 old_pos = (y * width + x) * 3 + c
                 new_pos = (x * height + (height - 1 - y)) * 3 + c
                 dstd[new_pos] = srcd[old_pos]
@@ -80,7 +80,7 @@
 def flip_ppm(srcd):
     dstd = array.array('B', len(srcd) * '\0')
     stride = width * 3
-    for y in xrange(height):
+    for y in range(height):
         dy = (height - 1 - y)
         dstd[dy * stride:(dy + 1) * stride] = srcd[y * stride:(y + 1) * stride]
     return dstd



More information about the grass-commit mailing list