[GRASS-user] Parallelization - Python

Johannes Radinger JRadinger at gmx.at
Fri Feb 18 06:45:13 EST 2011


Hej...

I am just trying to work out how to parallelize a simple Grassgis process in python via the thread module. Is that generally possible?

Lets say I have a linefeature I want to transform into a raster with follwing python command, where "n" should be 1,2 and 3 and the calculations should happen in parallel mode.

I am thinking about following first approach:


def main(n):

     grass.run_command("v.to.rast",
                      input = "line",
                      output = "line_raster",
                      use = "val",
                      value = n)
    return 0

if __name__ == "__main__":
    options, flags = grass.parser()
    sys.exit(main())

thread.start_new_thread(main, (1,)) 
thread.start_new_thread(main, (2,)) 
thread.start_new_thread(main, (3,))


Has anyone worked already with parallelization in Python in combination with GRASS GIS? How can a script look like for my purpose? I want to run the script from outside grass. Maybe someone can tell how to proceed....

thank you
Johannes
-- 
Schon gehört? GMX hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://www.gmx.net/de/go/toolbar


More information about the grass-user mailing list