[GRASS-user] r.sun in python loop
gene
martin.laloux at gmail.com
Sat Jul 7 16:06:28 PDT 2012
Read http://grass.osgeo.org/wiki/GRASS_and_Python
http://grass.osgeo.org/wiki/GRASS_and_Python
First, you need to set some environment variables:
export GISBASE="/usr/local/grass-6.4/"
export PATH="$PATH:$GISBASE/bin:$GISBASE/scripts"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GISBASE/lib"
# for parallel session management, we use process ID (PID) as lock file
number:
export GIS_LOCK=$$
# path to GRASS settings file
export GISRC="$HOME/.grassrc6"
After that in the Python Shell:
import grass.script as grass
gisbase = os.environ['GISBASE']
gisdb="/path/your grassdata"
location="your location"
mapset="your mapset"
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdb, location, mapset)
and you are working in the chosen location and mapset
# for example list of vectors
res = g.parse_command("g.list", _type="vect")
for elem in res:
print "element:" +elem
etc.
see
http://osgeo-org.1560.n6.nabble.com/Automatic-3D-geological-boreholes-representation-automate-v-extrude-from-a-table-my-solution-in-Pythn-td4978801.html
http://osgeo-org.1560.n6.nabble.com/Automatic-3D-geological-boreholes-representation-automate-v-extrude-from-a-table-my-solution-in-Pythn-td4978801.html
,
http://osgeo-org.1560.n6.nabble.com/access-vertices-coordinates-of-a-line-from-Python-td4983417.html
http://osgeo-org.1560.n6.nabble.com/access-vertices-coordinates-of-a-line-from-Python-td4983417.html
or
http://osgeo-org.1560.n6.nabble.com/GRASS-and-the-Python-geospatial-modules-Shapely-PySAL-td4985075.html
for some scripts and references
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/r-sun-in-python-loop-tp4986713p4986726.html
Sent from the Grass - Users mailing list archive at Nabble.com.
More information about the grass-user
mailing list