[GRASS-SVN] r72911 - grass-addons/grass7/imagery/i.segment.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 26 03:02:04 PDT 2018
Author: mlennert
Date: 2018-06-26 03:02:04 -0700 (Tue, 26 Jun 2018)
New Revision: 72911
Modified:
grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
Log:
i.segment.stats: check earlier for existance of raster
Modified: grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py
===================================================================
--- grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2018-06-26 05:49:25 UTC (rev 72910)
+++ grass-addons/grass7/imagery/i.segment.stats/i.segment.stats.py 2018-06-26 10:02:04 UTC (rev 72911)
@@ -120,9 +120,6 @@
rastername = raster.split('@')[0]
rastername = rastername.replace('.', '_')
temp_file = stat_temp_file + '.' + rastername
- if not gscript.find_file(raster, element='cell')['name']:
- gscript.message(_("Cannot find raster %s" % raster))
- return
gscript.run_command('r.univar',
map_=raster,
zones=segment_map,
@@ -196,6 +193,12 @@
if rasters:
gscript.message(_("Calculating statistics for raster maps..."))
+ for raster in rasters:
+ if not gscript.find_file(raster, element='cell')['name']:
+ gscript.message(_("Cannot find raster '%s'" % raster))
+ gscript.message(_("Removing this raster from list."))
+ rasters.remove(raster)
+
if len(rasters) < processes:
processes = len(rasters)
gscript.message(_("Only one process per raster. Reduced number of processes to %i." % processes))
More information about the grass-commit
mailing list