[GRASS-SVN] r67381 - grass-addons/grass7/raster/r.subdayprecip.design
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 26 04:45:21 PST 2015
Author: martinl
Date: 2015-12-26 04:45:20 -0800 (Sat, 26 Dec 2015)
New Revision: 67381
Modified:
grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html
grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py
Log:
r.subdayprecip.design: add support for points
Modified: grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html
===================================================================
--- grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html 2015-12-26 12:35:21 UTC (rev 67380)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html 2015-12-26 12:45:20 UTC (rev 67381)
@@ -58,8 +58,6 @@
computational region resolution),
see <a href="https://trac.osgeo.org/grass/ticket/2768">related bug
report</a></li>
- <li><em>r.subdayprecip.design</em> currently supports only vector
- <i>area</i> input, <i>points</i> are not supported</li>
</ul>
<h2>REFERENCES</h2>
Modified: grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py
===================================================================
--- grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py 2015-12-26 12:35:21 UTC (rev 67380)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py 2015-12-26 12:45:20 UTC (rev 67381)
@@ -121,6 +121,11 @@
return 1
allowed_rasters = ('H_002', 'H_005', 'H_010', 'H_020', 'H_050', 'H_100')
+
+ # test input feature type
+ vinfo = grass.vector_info_topo(opt['map'])
+ if vinfo['areas'] < 1 and vinfo['points'] < 1:
+ grass.fatal(_("No points or areas found in input vector map <{}>").format(opt['map']))
# extract multi values to points
for rast in opt['raster'].split(','):
@@ -138,8 +143,12 @@
# perform zonal statistics
grass.message('Processing <{}>...'.format(rast))
table = '{}_table'.format(name)
- Module('v.rast.stats', flags='c', map=opt['map'], raster=rast,
- column_prefix=name, method='average', quiet=True)
+ if vinfo['areas'] > 0:
+ Module('v.rast.stats', flags='c', map=opt['map'], raster=rast,
+ column_prefix=name, method='average', quiet=True)
+ else: # -> points
+ Module('v.what.rast', map=opt['map'], raster=rast,
+ column='{}_average'.format(name), quiet=True)
# TODO: handle null values (very small areas)
# Module('v.what.rast', map=opt['map'], raster=rast, type='centroid',
# column='{}_average'.format(name),
More information about the grass-commit
mailing list