[GRASS-SVN] r69981 - grass-addons/grass7/raster/r.randomforest

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 2 09:14:44 PST 2016


Author: spawley
Date: 2016-12-02 09:14:44 -0800 (Fri, 02 Dec 2016)
New Revision: 69981

Modified:
   grass-addons/grass7/raster/r.randomforest/ml_utils.py
Log:
bug fix to r.randomforest

Modified: grass-addons/grass7/raster/r.randomforest/ml_utils.py
===================================================================
--- grass-addons/grass7/raster/r.randomforest/ml_utils.py	2016-12-02 16:47:10 UTC (rev 69980)
+++ grass-addons/grass7/raster/r.randomforest/ml_utils.py	2016-12-02 17:14:44 UTC (rev 69981)
@@ -114,7 +114,7 @@
         else:
             response_np = np.memmap(filename=os.path.join(tmpdir, 'response'),
                                     dtype='float32', mode='w+',
-                                    shape=(current.rows, current.cols))
+                                    shape=((current.rows, current.cols)))
             response_np[:] = np.array(roi_gr)[:]
     else:
         grass.fatal("GRASS response raster does not exist.... exiting")
@@ -140,13 +140,13 @@
     else:
         training_data = np.memmap(os.path.join(tmpdir, 'training'),
                                   dtype='float32', mode='w+',
-                                  shape=(n_labels, n_features))
+                                  shape=((n_labels, n_features)))
 
     # Loop through each raster and sample pixel values at training indexes
     if lowmem is True:
         feature_np = np.memmap(os.path.join(tmpdir, 'feature'),
 					   dtype='float32', mode='w+',
-                               shape=(current.rows, current.cols))
+                               shape=((current.rows, current.cols)))
 
     for f in range(n_features):
         predictor_gr = RasterRow(predictors[f])



More information about the grass-commit mailing list