I am processing 18,000 feature classes (saved in a file GDB), each with ~500 records (polygon features) in ocean areas, and I am running a script to remove area overlapping with the coast, using the Erase function. The script is running successfully, but literally taking days to complete. Some files take seconds to process (I'm assuming this is due to the fact, which I've verified, that they are not overlapping with coastline) while some feature classes take over an hour to process.
I am working locally on my machine, running the script in IDLE, with ArcGIS 10.1 (all licenses) on a 32-bit Windows 7, 3.33GHz Intel DuoCore, 4GB RAM computer.
I'm learning the ropes with Python and would really appreciate tips on my script if there are steps I can take to speed up processing time. Thank you!
# Import modules import arcpy import sys import os from arcpy import env arcpy.env.overwriteOutput = True print arcpy.env.overwriteOutput #Erase coastline from selected buffers. workspace = "C:\\DIR\\points_buff\\" arcpy.env.workspace = workspace erase_output = workspace+"erased.gdb\\" erasedirectorypath = "C:\\DIR\\points_buff\\selectedbuff.gdb" fileList =  for dirpath, dirnames, erases in arcpy.da.Walk(erasedirectorypath, datatype="FeatureClass", type="Polygon"): for erase in erases: fileList.append(os.path.join(dirpath, erase)) filenameparts = erase.split('_') if int(filenameparts) > int(1967): try: #Set variables for Erase tool in_features = erasedirectorypath+"\\"+erase coastline_feat = "C:\\DIR\\Basic_NE.gdb\\Coastline_Eastern_US" out_erase_feat = erase_output+erase[:-4]+"_er" arcpy.Erase_analysis(in_features, coastline_feat, out_erase_feat, '') print arcpy.GetMessages() print "Coastline has been erased from " + erase + " and saved to " + erase_output except: print arcpy.GetMessages()