[GRASS-SVN] r73985 - grass-addons/grass7/raster/r.learn.ml
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 20 12:34:36 PST 2019
Author: spawley
Date: 2019-01-20 12:34:36 -0800 (Sun, 20 Jan 2019)
New Revision: 73985
Modified:
grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py
Log:
r.learn.ml remove unneeded function maps_from_group
Modified: grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py
===================================================================
--- grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py 2019-01-20 18:22:04 UTC (rev 73984)
+++ grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py 2019-01-20 20:34:36 UTC (rev 73985)
@@ -406,7 +406,6 @@
import os
import tempfile
from copy import deepcopy
-from subprocess import PIPE
import numpy as np
import grass.script as gs
from grass.pygrass.modules.shortcuts import raster as r
@@ -632,32 +631,6 @@
return(X, y, groups, coords)
-def maps_from_group(group):
- """
- Parse individual rasters into a list from an imagery group
-
- Args
- ----
- group (string): Name of GRASS imagery group
-
- Returns
- -------
- maplist (list): List containing individual GRASS raster maps
- map_names (list): List with print friendly map names
- """
- groupmaps = im.group(group=group, flags="g",
- quiet=True, stdout_=PIPE).outputs.stdout
-
- maplist = groupmaps.split(os.linesep)
- maplist = maplist[0:len(maplist)-1]
- map_names = []
-
- for rastername in maplist:
- map_names.append(rastername.split('@')[0])
-
- return(maplist, map_names)
-
-
def save_model(estimator, X, y, sample_coords, groups, filename):
from sklearn.externals import joblib
joblib.dump((estimator, X, y, sample_coords, group_id), filename)
@@ -1494,7 +1467,8 @@
balance = flags['b']
# fetch individual raster names from group
- maplist, _ = maps_from_group(group)
+ maplist = gs.read_command("i.group", group=group, flags="g").split(os.linesep)[:-1]
+ # map_names = [i.split('@')[0] for i in maplist]
# extract indices of category maps
if categorymaps.strip() == '':
More information about the grass-commit
mailing list