[GRASS-SVN] r72622 - grass-addons/grass7/raster/r.subdayprecip.design
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 17 02:27:50 PDT 2018
Author: martinl
Date: 2018-04-17 02:27:49 -0700 (Tue, 17 Apr 2018)
New Revision: 72622
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; revert r72613:72614
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-16 09:27:51 UTC (rev 72621)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.html 2018-04-17 09:27:49 UTC (rev 72622)
@@ -14,18 +14,6 @@
<h2>NOTES</h2>
-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>-r</b> flag. In this case calculated
-avarage value for large areas is reduced by coefficient below.
-
-<pre>
- k = exp(-0.08515989 * (x^2) - 0.001344925 * (x^4))
-
- where x = log10(area_size_km2) - 0.9
-</pre>
-
-<p>
Subday design precipitation series are important for hydrological
modelling and soil erosion problems in a small catchment scale when
designing common measures for promoting water retention, landscape
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-16 09:27:51 UTC (rev 72621)
+++ grass-addons/grass7/raster/r.subdayprecip.design/r.subdayprecip.design.py 2018-04-17 09:27:49 UTC (rev 72622)
@@ -8,7 +8,7 @@
#
# PURPOSE: Computes subday design precipitation totals.
#
-# COPYRIGHT: (C) 2015-2018 Martin Landa and GRASS development team
+# COPYRIGHT: (C) 2015 Martin Landa and GRASS development team
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
@@ -24,12 +24,12 @@
#%end
#%option G_OPT_V_MAP
-#% label: Name of input vector map of location under analysis
+#% label: Vector map of location under analysis
#%end
#%option G_OPT_R_INPUTS
#% key: return_period
-#% description: Name of input rainfall raster maps of required return period
+#% description: Rainfall raster maps of required return period
#% options: N2,N5,N10,N20,N50,N100
#%end
@@ -48,18 +48,11 @@
#% answer: 20
#%end
-#%flag
-#% key: r
-#% description: Process also large areas above area_size limit by applying a reduction
-#%end
-
import os
import sys
-import math
import grass.script as grass
from grass.pygrass.modules import Module
-from grass.pygrass.vector import VectorTopo
from grass.exceptions import CalledModuleError
def coeff(name, rl):
@@ -127,24 +120,6 @@
return a, c
-
-def area_size_reduction(map_name, field_name, area_col_name):
- vmap = VectorTopo(map_name)
- vmap.open('rw')
-
- 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))
- feat.attrs[field_name] *= k
- cats.append(feat.attrs['cat'])
-
- vmap.table.conn.commit()
- vmap.close()
-
def main():
# check if the map is in the current mapset
mapset = grass.find_file(opt['map'], element='vector')['mapset']
@@ -176,7 +151,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['r']:
+ if large_areas > 0:
grass.warning('{} areas larger than size limit will be skipped from computation'.format(large_areas))
# extract multi values to points
@@ -233,15 +208,9 @@
column=field_name, query_column=expression)
if check_area_size:
- args = {}
- if flg['r']:
- area_size_reduction(opt['map'], field_name, area_col_name)
- else:
- Module('v.db.update', map=opt['map'],
- column=field_name,
- value='-1',
- where='{} > {}'.format(area_col_name, opt['area_size']),
- **args)
+ Module('v.db.update', map=opt['map'],
+ column=field_name, value='-1',
+ where='{} > {}'.format(area_col_name, opt['area_size']))
# remove unused column
Module('v.db.dropcolumn', map=opt['map'],
More information about the grass-commit
mailing list