[GRASS-SVN] r71022 - grass-addons/grass7/raster/r.vect.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 5 00:52:09 PDT 2017
Author: martinl
Date: 2017-05-05 00:52:09 -0700 (Fri, 05 May 2017)
New Revision: 71022
Modified:
grass-addons/grass7/raster/r.vect.stats/r.vect.stats.html
grass-addons/grass7/raster/r.vect.stats/r.vect.stats.py
Log:
r.vect.stats: column and method parameters added, if no column is defined then count number of points in cell
Modified: grass-addons/grass7/raster/r.vect.stats/r.vect.stats.html
===================================================================
--- grass-addons/grass7/raster/r.vect.stats/r.vect.stats.html 2017-05-05 02:48:20 UTC (rev 71021)
+++ grass-addons/grass7/raster/r.vect.stats/r.vect.stats.html 2017-05-05 07:52:09 UTC (rev 71022)
@@ -21,6 +21,7 @@
<em>
<a href="g.region.html">g.region</a>,
+<a href="v.out.ascii.html">v.out.ascii</a>,
<a href="r.in.xyz.html">r.in.xyz</a>,
<a href="r.in.lidar.html">r.in.lidar</a>
</em>
@@ -28,7 +29,10 @@
<h2>AUTHOR</h2>
-Vaclav Petras, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU GeoForAll Lab</a>
+Vaclav Petras, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU GeoForAll Lab</a><br/>
+Column and method parameters added by Martin
+Landa, <a href="http://geomatics.fsv.cvut.cz/research/geoforall/">CTU
+GeoForAll Lab</a>
<p>
<i>Last changed: $Date: 2017-04-14 18:20:35 -0400 (Fri, 14 Apr 2017) $</i>
Modified: grass-addons/grass7/raster/r.vect.stats/r.vect.stats.py
===================================================================
--- grass-addons/grass7/raster/r.vect.stats/r.vect.stats.py 2017-05-05 02:48:20 UTC (rev 71021)
+++ grass-addons/grass7/raster/r.vect.stats/r.vect.stats.py 2017-05-05 07:52:09 UTC (rev 71022)
@@ -25,8 +25,16 @@
#%end
#%option G_OPT_R_OUTPUT
#%end
+#%option G_OPT_DB_COLUMN
+#% description: Name of attribute column for statistics
+#%end
+#%option
+#% key: method
+#% description: Statistic to use for attribute column
+#% options: min,max,range,sum,mean,stddev,variance,coeff_var,median,percentile,skewness,trimmean
+#% answer: mean
+#%end
-
import grass.script as gs
@@ -36,14 +44,18 @@
vector = options['input']
layer = 1
raster = options['output']
- method = 'mean'
+ method = 'n'
+ z = 3
sep = 'pipe'
+ if options['column']:
+ method = options['method']
+ z = 4
out_process = gs.pipe_command(
'v.out.ascii', input=vector, layer=layer, format='point',
- separator=sep)
+ column=options['column'], separator=sep)
in_process = gs.start_command(
- 'r.in.xyz', input='-', output=raster, method=method,
+ 'r.in.xyz', input='-', output=raster, method=method, z=z,
separator=sep, stdin=out_process.stdout)
in_process.communicate()
out_process.wait()
More information about the grass-commit
mailing list