فهرست منبع

Add a new function to get grass environment variables

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54051 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 سال پیش
والد
کامیت
1ad2e17255
1فایلهای تغییر یافته به همراه11 افزوده شده و 0 حذف شده
  1. 11 0
      lib/python/pygrass/functions.py

+ 11 - 0
lib/python/pygrass/functions.py

@@ -14,6 +14,7 @@ from grass.script import core as grasscore
 from pygrass.errors import GrassError
 from pygrass.region import Region
 
+
 def looking(filter_string, obj):
     """
     >>> import grass.lib.vector as libvect
@@ -43,6 +44,16 @@ def copy(existingmap, newmap, maptype):
                                                            new=newmap), })
 
 
+def getenv(env):
+    """Return the current grass environment variables:
+
+        >>> getenv("MAPSET")
+        'user1'
+
+    .."""
+    return libgis.G__getenv(env)
+
+
 def get_mapset_raster(mapname, mapset=''):
     return libgis.G_find_raster(mapname, '')