I'm trying to automate a workflow that currently costs a co-worker about 45 minutes. General run down is this person copies files from a network drive onto a local one, and process it through four separate ArcGIS models, the code below does not comprise all of the geoprocesses that are run against these files, but the point in which the bog down is happening. As it stands, each model takes about 12 minutes to run. The code below works, but it literally takes about an hour and a half on the same exact data. I'm using arcpy.da.Walk because I figured I could save all the clicks and just run it in the background. Pretty new to coding, but been doing it about 2 years - could it be the fnmatch? My gut tells me it's the walk, and building the list - wondering if there is an alternative.
I have attempted to replicate the workflow (copying the directories locally, and not over the network).
def main(): try: import arcpy, os, sys, fnmatch, traceback arcpy.env.overwriteOutput = True rootDir = arcpy. GetParameterAsText(0) outDir = arcpy.GetParameterAsText (1) mssn = '"12"' sensor = '"Geo"' dissolveFld = ["Date"] search = "*pan*.shp" outName = "test" shpMergeLst =  for root, dir, files in arcpy.da.Walk(rootDir): for filename in fnmatch.filter(files, search): shpMergeLst.append(os.path.join(root, filename)) if shpMergeLst: outShp = os.path.join(outDir, os.path.basename(outName[:-4]) + "_Merge.shp") arcpy.Merge_management(shpMergeLst, outShp)
Don't have system specs, but currently running ArcGIS 10.1 Advanced