[GRASS-SVN] r71102 - in grass-addons/grass7/raster/r.green: libgreen r.green.gshp/r.green.gshp.theoretical

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 21 23:11:21 PDT 2017


Author: zarch
Date: 2017-05-21 23:11:21 -0700 (Sun, 21 May 2017)
New Revision: 71102

Modified:
   grass-addons/grass7/raster/r.green/libgreen/utils.py
   grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py
Log:
r.green: Move raster_or_numb function from r.green.gshp.theoretical to shared library

Modified: grass-addons/grass7/raster/r.green/libgreen/utils.py
===================================================================
--- grass-addons/grass7/raster/r.green/libgreen/utils.py	2017-05-19 13:43:36 UTC (rev 71101)
+++ grass-addons/grass7/raster/r.green/libgreen/utils.py	2017-05-22 06:11:21 UTC (rev 71102)
@@ -34,6 +34,12 @@
                               pattern=pattern)
 
 
+def rast_or_numb(rast, numb, opts):
+    """Return a float or a string with the raster name.
+    """
+    return opts[rast] if opts[rast] else float(opts[numb])
+
+
 def check_overlay_rv(raster, vector):
     """
     check the overlay between a raster and a vector

Modified: grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py	2017-05-19 13:43:36 UTC (rev 71101)
+++ grass-addons/grass7/raster/r.green/r.green.gshp/r.green.gshp.theoretical/r.green.gshp.theoretical.py	2017-05-22 06:11:21 UTC (rev 71102)
@@ -3,7 +3,7 @@
 #
 ############################################################################
 #
-# MODULE:      r.green.geothermal.potential
+# MODULE:      r.green.gshp.theoretical
 # AUTHOR(S):   Pietro Zambelli
 # PURPOSE:     Calculate the Near Surface Geothermal Energy potential
 # COPYRIGHT:   (C) 2017 by the GRASS Development Team
@@ -211,24 +211,18 @@
     # set python path to the shared r.green libraries
     set_path('r.green', 'libgshp', '..')
     set_path('r.green', 'libgreen', os.path.join('..', '..'))
-    from libgreen.utils import cleanup
+    from libgreen.utils import cleanup, rast_or_numb
     from libgshp import gpot
 except ImportError:
     try:
         set_path('r.green', 'libgshp', os.path.join('..', 'etc', 'r.green'))
         set_path('r.green', 'libgreen', os.path.join('..', 'etc', 'r.green'))
-        from libgreen.utils import cleanup
+        from libgreen.utils import cleanup, rast_or_numb
         from libgshp import gpot
     except ImportError:
-        gcore.warning('libgreen and libhydro not in the python path!')
+        gcore.warning('libgreen and libgshp not in the python path!')
 
 
-def rast_or_numb(rast, numb, opts):
-    """Return a float or a string with the raster name.
-    """
-    return opts[rast] if opts[rast] else float(opts[numb])
-
-
 def main(opts, flgs):
     """
     Parameters



More information about the grass-commit mailing list