[GRASS-SVN] r72614 - grass-addons/grass7/raster/r.subdayprecip.design

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 10 05:01:09 PDT 2018


Author: martinl
Date: 2018-04-10 05:01:08 -0700 (Tue, 10 Apr 2018)
New Revision: 72614

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: rename -k to -r flag

Modified: grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html
===================================================================
--- grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html	2018-04-10 09:48:14 UTC (rev 72613)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html	2018-04-10 12:01:08 UTC (rev 72614)
@@ -16,7 +16,7 @@
 
 By default areas above <b>area_size</b> limit are not processed
 (calculated value is set to -1 in such case). Processing of large
-areas can be enabled by specifying <b>-k</b> flag. In this case calculated
+areas can be enabled by specifying <b>-r</b> flag. In this case calculated
 avarage value for large areas is reduced by coefficient below.
 
 <pre>

Modified: grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py
===================================================================
--- grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py	2018-04-10 09:48:14 UTC (rev 72613)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py	2018-04-10 12:01:08 UTC (rev 72614)
@@ -49,8 +49,8 @@
 #%end
 
 #%flag
-#% key: k
-#% description: Process also large areas above area_size limit by applying reduction
+#% key: r
+#% description: Process also large areas above area_size limit by applying a reduction
 #%end
 
 import os
@@ -134,6 +134,8 @@
 
     cats = [] # TODO: do it better
     for feat in vmap.viter('areas'):
+        if not feat.attrs[field_name]:
+            continue
         if feat.attrs['cat'] not in cats:
             x = math.log10(float(feat.attrs[area_col_name]) )- 0.9
             k = math.exp(-0.08515989 * pow(x, 2) - 0.001344925 * pow(x, 4))
@@ -174,7 +176,7 @@
                        where='{} > {}'.format(area_col_name, opt['area_size']),
                        stdout_=grass.PIPE)
         large_areas = len(areas.outputs.stdout.splitlines())
-        if large_areas > 0 and not flg['k']:
+        if large_areas > 0 and not flg['r']:
             grass.warning('{} areas larger than size limit will be skipped from computation'.format(large_areas))
 
     # extract multi values to points
@@ -232,7 +234,7 @@
 
         if check_area_size:
             args = {}
-            if flg['k']:
+            if flg['r']:
                 area_size_reduction(opt['map'], field_name, area_col_name)
             else:
                 Module('v.db.update', map=opt['map'],



More information about the grass-commit mailing list