[GRASS-dev] Python script problem

Michael Barton michael.barton at asu.edu
Thu Oct 25 12:36:00 EDT 2007


Try the following...


On 10/25/07 1:26 AM, "monik1982 at libero.it" <monik1982 at libero.it> wrote:

>     cmdargs1= ["elevation=%s" %dtm]
>     cmdargs2=["slope=slope1", "format=percent", "--overwrite"]
>     os.execvp("r.slope.aspect", ["r.slope.aspect"] + cmdargs1 + cmdargs2)
> 
> 
>     cmdargs3=["input=slope1", "output=slope_prova1", "method=average",
> "size=9"]   
>     os.execvp("r.neighbors",["r.neighbors"] + cmdargs3)


cmdargs1= ["r.slope.aspect","elevation=%s" %dtm,"slope=slope1",
"format=percent", "--overwrite"]

cmdargs2=["r.neighbors", "input=slope1", "output=slope_prova1",
"method=average","size=9"]

p1 = subprocess.Popen(cmdargs1)

# NOTE: you may have to insert a wait or something here to make sure that
# slope1 is created before running the next process

p2 = subprocess.Popen(cmdargs2)

# you can do more sophisticated things with Popen if you want
# and can check return values by parsing p1 and p2

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton 




More information about the grass-dev mailing list