Hamish wrote: > in making some of the python modules multithreaded, it would > be useful to have a version of grass.mapcalc() which didn't > wait until it was done, and returned the Popen object instead. > > e.g. to process three r,g,b bands in parallel. > > I just added an experimental grass.mapcalc_start() fn to > trunk/lib/python/raster.py,
an example for running 3 r.mapcalcs in parallel: before: grass.mapcalc('%s.red = r#%s' % (out, in_R)) grass.mapcalc('%s.grn = g#%s' % (out, in_G)) grass.mapcalc('%s.blu = b#%s' % (out, in_B)) after: pr = grass.mapcalc_start('%s.red = r#%s' % (out, in_R)) pg = grass.mapcalc_start('%s.grn = g#%s' % (out, in_G)) pb = grass.mapcalc_start('%s.blu = b#%s' % (out, in_B)) pr.wait() pg.wait() pb.wait() since the parent process retains control of the pipes by default, AFAIK p.communicate() is not needed here, errors and messages just get propagated to the terminal as they occur. Hamish _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev