[GRASS-SVN] r69974 - grass-addons/grass7/raster/r.randomforest
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 1 21:33:45 PST 2016
Author: spawley
Date: 2016-12-01 21:33:45 -0800 (Thu, 01 Dec 2016)
New Revision: 69974
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 05:28:28 UTC (rev 69973)
+++ grass-addons/grass7/raster/r.randomforest/ml_utils.py 2016-12-02 05:33:45 UTC (rev 69974)
@@ -102,7 +102,7 @@
"""
current = Region()
- tmpdir = grass.tempdir()
+ tmpdir = grass.tempdir()
# open response raster as rasterrow and read as np array
if RasterRow(response).exist() is True:
@@ -135,18 +135,18 @@
n_labels = np.array(is_train).shape[1]
# Create a zero numpy array of len training labels
- if lowmem is False:
- training_data = np.zeros((n_labels, n_features))
- else:
- training_data = np.memmap(os.path.join(tmpdir, 'training'),
+ if lowmem is False:
+ training_data = np.zeros((n_labels, n_features))
+ else:
+ training_data = np.memmap(os.path.join(tmpdir, 'training'),
dtype='float32', mode='w+',
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))
+ feature_np = np.memmap(os.path.join(tmpdir, 'feature',
+ dtype='float32', mode='w+',
+ shape=(current.rows, current.cols)))
for f in range(n_features):
predictor_gr = RasterRow(predictors[f])
More information about the grass-commit
mailing list