[GRASS-SVN] r70081 - grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 15 09:07:52 PST 2016


Author: Giulia
Date: 2016-12-15 09:07:52 -0800 (Thu, 15 Dec 2016)
New Revision: 70081

Modified:
   grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
Log:
r.green: fix bug electroline length update

Modified: grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py	2016-12-14 22:22:06 UTC (rev 70080)
+++ grass-addons/grass7/raster/r.green/r.green.hydro/r.green.hydro.financial/r.green.hydro.financial.py	2016-12-15 17:07:52 UTC (rev 70081)
@@ -717,15 +717,16 @@
             elines = (opts['elines'] if opts['elines']
                       else ('tmprgreen_%i_elines' % pid))
             for cat, line in enumerate(vect):
-                if line.attrs[kcol] == ktype and line.attrs['side']=='option1':
+                if line.attrs[kcol] == ktype:
                     # the turbine is the last point of the penstock
                     turbine = line[-1]
                     # find the closest electro line
                     eline = electro.find['by_point'].geo(turbine, maxdist=1e6)
                     dist = eline.distance(turbine)
                     line.attrs['electro_length'] = dist.dist
-                    ltemp.append([geo.Line([turbine, dist.point]),
-                                 (line.attrs['plant_id'], line.attrs['side'])])
+                    if line.attrs['side'] == 'option1':
+                        ltemp.append([geo.Line([turbine, dist.point]),
+                                     (line.attrs['plant_id'], line.attrs['side'])])
                 else:
                     line.attrs['electro_length'] = 0.
             vect.table.conn.commit()



More information about the grass-commit mailing list