[GRASS-SVN] r72271 - grass-addons/grass7/raster/r.neighborhoodmatrix
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 22 02:29:16 PST 2018
Author: mlennert
Date: 2018-02-22 02:29:16 -0800 (Thu, 22 Feb 2018)
New Revision: 72271
Modified:
grass-addons/grass7/raster/r.neighborhoodmatrix/r.neighborhoodmatrix.py
Log:
r.neighborhoodmatrix: check for CELL type in input and avoid name conflict of tempfiles
Modified: grass-addons/grass7/raster/r.neighborhoodmatrix/r.neighborhoodmatrix.py
===================================================================
--- grass-addons/grass7/raster/r.neighborhoodmatrix/r.neighborhoodmatrix.py 2018-02-22 09:06:05 UTC (rev 72270)
+++ grass-addons/grass7/raster/r.neighborhoodmatrix/r.neighborhoodmatrix.py 2018-02-22 10:29:16 UTC (rev 72271)
@@ -78,7 +78,8 @@
gscript.run_command('r.mapcalc',
expression=expression,
quiet=True)
- tf = gscript.tempfile()
+ tfdir = gscript.tempdir()
+ tf = os.path.join(tfdir, mapname)
rstats_results = gscript.read_command('r.stats',
input_=[rinput, mapname],
flags='nc',
@@ -105,6 +106,11 @@
rinput = options['input']
output = options['output']
+ #Check that input map is CELL
+ datatype = gscript.parse_command('r.info', flags='g', map=rinput)['datatype']
+ if datatype != 'CELL':
+ gscript.fatal("Input map has to be of CELL (integer) type")
+
global separator
separator = gscript.separator(options['separator'])
processes = int(options['processes'])
More information about the grass-commit
mailing list