I am using ModelBuilder to get some results (using various tools) and assign the results to a .dbf file. Each time the For loop runs the program calculates some values and assigns it to designated rows of the export.dbf file. For that I am using "Calculate Field" Tool. This tool assigns the calculated value i.e OFIPS, DFIPS, SNO, NearFID and NearDist to designated rows of Export.dbf. The tool works really quick (1-2 secs) at first but keeps on slowing down (8-10 secs) after say, hundreds of iterations. The speed of the "Calculate field" tool is critical to the speed of the overall ModelBuilder.
Is there any way that the ModelBuilder not slow down the time for each iteration as the number of iterations increase.
The above screenshot shows the slow part in blue circle.
-
1Can you please outline what your calculate field tools are doing? Are the values linked to inputs somewhere else?Midavalo– Midavalo ♦2017年02月15日 18:00:25 +00:00Commented Feb 15, 2017 at 18:00
-
@Midavalo The Calculate Field tool is assigning the results obtained, i.e NearDist, NearFID, OFIPS and DFIPSpnkjmndhl– pnkjmndhl2017年02月15日 18:03:02 +00:00Commented Feb 15, 2017 at 18:03
-
1Please edit your question to include any response to commentsMidavalo– Midavalo ♦2017年02月15日 18:03:39 +00:00Commented Feb 15, 2017 at 18:03
-
1Since that section isn't connected to anything, at what point is it executed during the for loop?Paul– Paul2017年02月15日 18:15:56 +00:00Commented Feb 15, 2017 at 18:15
-
@ paul It runs after the tool "get field by values" (far right on the image) and Yes it executes on each loop. From my experience the tool doesnot have to connected to each other to run.pnkjmndhl– pnkjmndhl2017年02月15日 18:17:30 +00:00Commented Feb 15, 2017 at 18:17
1 Answer 1
I have not dissected your model to try and reproduce what you are describing because I think I encountered something similar 5 or so years ago.
In your model I think you should try to replace your multiple Calculate Field tools by writing a single Python script tool that is a wrapper around an arcpy.da.UpdateCursor() so that as you iterate through each row you can apply multiple updates to that row.
Explore related questions
See similar questions with these tags.