I’m programming a few Scripts and I would like to know How can I access some global variables value such as GRASS_DIR, MAPSET; LOCATIOn or even others that I defined (e.g. GRASS_TEMP). How can I load and access them? (I’m working with Python scripts for GRASS 7)
In data giovedì 25 febbraio 2010 19:34:25, Luis Lisboa ha scritto:
: > Hi
I'm programming a few Scripts and I would like to know How can I access
some global variables value such as GRASS_DIR, MAPSET; LOCATIOn or even
others that I defined (e.g. GRASS_TEMP). How can I load and access them?
(I'm working with Python scripts for GRASS 7)
I'm programming a few Scripts and I would like to know How can I access some
global variables value such as GRASS_DIR, MAPSET; LOCATIOn or even others
that I defined (e.g. GRASS_TEMP). How can I load and access them? (I'm
working with Python scripts for GRASS 7)
The main difference between the two is that the former raises an
exception if the variable doesn't exist while the latter returns None
(or a user-defined value specified by the second argument).
$GISRC variables (GISDBASE, LOCATION_NAME, MAPSET) can be accessed via
grass.script.gisenv(), e.g.
import grass.script as grass
env = grass.gisenv()
mapset = env["MAPSET"]