[GRASS-SVN] r66292 - in grass-addons/grass7/raster/r.green/r.green.hydro: libhydro r.green.hydro.theoretical
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 22 07:30:57 PDT 2015
Author: Giulia
Date: 2015-09-22 07:30:57 -0700 (Tue, 22 Sep 2015)
New Revision: 66292
Modified:
grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py
grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
Log:
r.green: fix bug about the computation of the basin mean elevation
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py 2015-09-22 12:59:11 UTC (rev 66291)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/libhydro/basin.py 2015-09-22 14:30:57 UTC (rev 66292)
@@ -630,14 +630,21 @@
"""
Fill the dictionary with the basins attribute
"""
- info_h = gcore.parse_command('r.category', map='dtm_mean', separator='=')
+ pid = os.getpid()
+ tmp_dtm_mean = "tmprgreen_%i_dtm_mean" % pid
+ gcore.run_command('r.stats.zonal',
+ base=basins,
+ cover=dtm, flags='r',
+ output=tmp_dtm_mean,
+ method='average')
+ info_h = gcore.parse_command('r.category', map=tmp_dtm_mean, separator='=')
#pdb.set_trace()
for count in inputs:
if info_h[str(count)] != '':
area = area_of_basins(basins, count, dtm)
basins_tot[count].area = float(area)
h_mean = float(info_h[str(count)])
- fill_energyown(basins_tot[count], h_mean, discharge, stream)
+ fill_energyown(basins_tot[count], h_mean, discharge, stream)
for b in inputs:
fill_discharge_tot(basins_tot, b)
Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py 2015-09-22 12:59:11 UTC (rev 66291)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.theoretical/r.green.hydro.theoretical.py 2015-09-22 14:30:57 UTC (rev 66292)
@@ -187,14 +187,6 @@
#############################################################
basins_tot, inputs = basin.init_basins(basins)
- msgr.message("\nCompute mean elevation\n")
- tmp_dtm_mean = "tmprgreen_%i_dtm_mean" % pid
- gcore.run_command('r.stats.zonal',
- base=basins,
- cover=dtm, flags='r',
- output=tmp_dtm_mean,
- method='average')
-
msgr.message("\nBuild the basin network\n")
#############################################################
# build_network(stream, dtm, basins_tot) build relationship among basins
More information about the grass-commit
mailing list