import os, multiprocessing, arcpy def project(raster): arcpy.ProjectRaster_management(raster...) def main(): workspace = r'c:\somepath' arcpy.env.workspace = workspace fcs = arcpy.ListRasters('*') fc_list = [os.path.join(workspace, fc) for fc in fcs] pool = multiprocessing.Pool() pool.map(project, fc_list) pool.close() pool.join()if __name__ == '__main__': main()
File "C:\Python26\ArcGIS10.0\lib\multiprocessing\process.py", line 232, in _bootstrap self.run() File "C:\Python26\ArcGIS10.0\lib\multiprocessing\process.py", line 88, in run self._target(*self._args, **self._kwargs)File "C:\Python26\ArcGIS10.0\lib\multiprocessing\pool.py", line 57, in worker task = get() File "C:\Python26\ArcGIS10.0\lib\multiprocessing\queues.py", line 352, in get return recv() AttributeError: 'module' object has no attribute'project'
ERROR 010302: Unable to create the output raster: C:\Data\sr6f8~1\FocalSt_srtm1 ERROR 010067: Error in executing grid expression. Failed to execute (FocalStatistics).
import os, multiprocessing, arcpy def project(rasterin, rasterout): arcpy.ProjectRaster_management(rasterin, rasterout,#�?� # just return something; will print once done return �??converted: %s and made output: %s�?? % (rasterin,rasterout) if __name__ == �??__main__�??: workspace = r�??d:\Temp\dems�?? arcpy.env.workspace = workspace fcs = arcpy.ListRasters(�??*�??) pool = multiprocessing.Pool() jobs = [] # iterate through features, add input and output paths for fc in fcs: rIn = os.path.join(workspace, fc) rOut = os.path.join(r�??d:\Temp\demsOut�??, fc) jobs.append(pool.apply_async(project, (rIn, rOut))) for job in jobs: print job.get()
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.