I am looping through an amount of point arrays, creating data on the fly.
The features/arrays, are largely similar in size. One thing I have noticed, is that when I start the process, the time it takes to perform, rises from about 8 seconds, to around 1 minute. I can't see why this is happening, but you cna see the times slowly increase if you put a timer around the loop.
Is there a way to increase this performance? Is there a flush method? I believe I am properly handling my objects and deleting them after use, but I cannot for the life of me see why it is happening?
Any ideas?
The code is refactored, so there may be some typos, etc.
def createGeom(geom,header,band,scratchDB,buffer, dist):
filetime = (str(time.time())).split(".")
outfile = "fc" + filetime[0]+filetime[1]
outpath = scratchDB + "tmp.gdb/Polygon/"
print outpath
sCon = ["1", "16", "2.0"]
ts = header.split(" ")
ti = ts[6]
Current = ts[9]
LL = ts[2][2:5]
LU = ts[2][8:11]
outFeatureAggClass = outpath+outfile+"_agg"
outFeatureClass = outpath+outfile
arcpy.AggregatePoints_cartography(geom, outFeatureAggClass, dist)
arcpy.Buffer_analysis(outFeatureAggClass, outFeatureClass, buffer)
arcpy.AddField_management(outFeatureClass, "Name", "Text")
arcpy.AddField_management(outFeatureClass, "ID", "SHORT")
arcpy.AddField_management(outFeatureClass, "LL", "SHORT")
arcpy.AddField_management(outFeatureClass, "LU", "SHORT")
arcpy.AddField_management(outFeatureClass, "Tim", "SHORT")
arcpy.AddField_management(outFeatureClass, "Band", "SHORT")
arcpy.AddField_management(outFeatureClass, "Lvl", "TEXT")
arcpy.AddField_management(outFeatureClass, "Cur", "SHORT")
rows = arcpy.UpdateCursor(outFeatureClass)
for row in rows:
row.name = outfile
row.ID = 1000
row.LL = int(LL)
row.LU = int(LU)
row.Tim = int(ti)
row.Band = int(band)
row.Lvl = sCon[int(band)]
row.Cur = Current
rows.updateRow(row)
del row
del rows
UPDATE
I am now running this in ArcMap, and it's taking significantly less time, to a factor or about 3 or 4; what took 30 mins, now takes 7.
What's that all about?
EDIT
ESRI have agreed to look at the issue. I'll park this for now, ready to update it with any progress.
