[GRASS-SVN] r60888 - grass-addons/grass7/imagery/i.segment.hierarchical
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 20 05:51:31 PDT 2014
Author: zarch
Date: 2014-06-20 05:51:31 -0700 (Fri, 20 Jun 2014)
New Revision: 60888
Modified:
grass-addons/grass7/imagery/i.segment.hierarchical/isegpatch.py
Log:
Comment an unsed function: node_patch
Modified: grass-addons/grass7/imagery/i.segment.hierarchical/isegpatch.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.hierarchical/isegpatch.py 2014-06-20 11:55:51 UTC (rev 60887)
+++ grass-addons/grass7/imagery/i.segment.hierarchical/isegpatch.py 2014-06-20 12:51:31 UTC (rev 60888)
@@ -4,15 +4,9 @@
@author: pietro
"""
-import os
-import re
-
-import grass.lib.gis as libgis
-
from grass.pygrass.modules.grid.patch import get_start_end_index
-from grass.pygrass.modules.grid.split import split_region_tiles
-from grass.pygrass.modules.grid.node import row_order
from grass.pygrass.raster import RasterRow
+from grass.pygrass.messages import get_msgr
def rpatch_row(rast, rasts, bboxes, max_rasts):
@@ -37,6 +31,7 @@
rast = RasterRow(prefix + raster, mapset)
with RasterRow(name=raster, mapset=mset_str % (0, 0), mode='r') as rtype:
rast.open('w', mtype=rtype.mtype, overwrite=overwrite)
+ msgr = get_msgr()
rasts = []
mrast = 0
nrows = len(bbox_list)
@@ -44,7 +39,7 @@
rrasts = []
max_rasts = []
for col in range(len(rbbox)):
- libgis.G_percent(row, nrows, 1)
+ msgr.percent(row, nrows, 1)
rrasts.append(RasterRow(name=raster,
mapset=mset_str % (start_row + row,
start_col + col)))
@@ -59,23 +54,29 @@
rast.close()
-
-def node_patch(cmd, nwidth, nheight, out_regexp, overwrite=True):
- from grass.lib.gis import G_tempfile
- tmp, dummy = os.path.split(os.path.split(G_tempfile())[0])
- tmpdir = os.path.join(cmd)
- bboxes = split_region_tiles(width=nwidth, height=nheight)
- for out in os.listdir(tmpdir):
- outdir = os.path.join(tmpdir, out)
- rasts = os.listdir(outdir)
- rsts = row_order(rasts, bboxes)
- rst = RasterRow(re.findall(out_regexp, rasts[0])[0])
- rst.open('w', mtype=rsts[0][0].mtype, overwrite=overwrite)
- for rrst, rbbox in zip(rsts, bboxes):
- rpatch_row(rst, rrst, rbbox)
-
- for rrst in rsts:
- for r in rrst:
- r.close()
-
- rst.close()
+# run on a cluster
+#import os
+#import re
+#from grass.pygrass.modules.grid.split import split_region_tiles
+#from grass.pygrass.modules.grid.node import row_order
+#
+#
+#def node_patch(cmd, nwidth, nheight, out_regexp, overwrite=True):
+# from grass.lib.gis import G_tempfile
+# tmp, dummy = os.path.split(os.path.split(G_tempfile())[0])
+# tmpdir = os.path.join(cmd)
+# bboxes = split_region_tiles(width=nwidth, height=nheight)
+# for out in os.listdir(tmpdir):
+# outdir = os.path.join(tmpdir, out)
+# rasts = os.listdir(outdir)
+# rsts = row_order(rasts, bboxes)
+# rst = RasterRow(re.findall(out_regexp, rasts[0])[0])
+# rst.open('w', mtype=rsts[0][0].mtype, overwrite=overwrite)
+# for rrst, rbbox in zip(rsts, bboxes):
+# rpatch_row(rst, rrst, rbbox)
+#
+# for rrst in rsts:
+# for r in rrst:
+# r.close()
+#
+# rst.close()
More information about the grass-commit
mailing list