Model runs fine in ModelBuilder but hangs in tool mode

1665
11
11-13-2018 01:24 PM
ThomasDilts
Occasional Contributor III

I've got a model with iteration that runs fine from within ModelBuilder.  In fact, I'd say that it is downright zippy taking about a minute for every 5 rows in a raster attribute table.  When I run that same model as a tool using the same datasets it grinds to a halt getting hung up on iteration 3 or 4.  Specifically it is the Cell Statistics tool and I'm using feedback to save the results from one iteration and then add the results from the next iteration and so on.   I'm wondering if anyone has any idea what would be different enough between ModelBuilder and "tool mode" to account for such a large difference in performance.  I'd hate to have to share a tool with others with the caveat that it can only be run from ModelBuilder especially when it is working so well otherwise.

Thanks

-Tom Dilts

0 Kudos
11 Replies
ThomasDilts
Occasional Contributor III

Hi Duncan.  Thanks for the heads up.  I ended up dropping the Cell Statistics altogether replacing it with the Plus tool, but to no avail.  I'm thinking that the next step might be to try exporting the model out to python, re-do the coding for the looping, and then see where that takes me.  The good news is that it works in edit mode for what I want it to do.

0 Kudos
ThomasDilts
Occasional Contributor III

Hi everyone,

Sorry about the long delay.  Converting the model to a python script did the trick.  Now the tool iterates fine and works like a charm.  Strangely, I still have no clue why the tool performs poorly as a model, but thank you everyone who contributed ideas.  They were all helpful steps along the way.  I'm expecting to a release a new geoprocessing toolbox sometime soon (Q1 of 2019) - the Lattice Connectivity Toolbox.  The toolbox assesses habitat connectivity using a lattice or tessellation and a resistance kernel approach and is designed to serve as inputs into graph theoretic models.  The toolbox is a refinement of the approach that I outline in a 2016 paper.

Dilts, T. E., Weisberg, P. J., Leitner, P., Matocq, M. D., Inman, R. D., Nussear, K. E., & Esque, T. C. (2016). Multiscale connectivity and graph theory highlight critical areas for conservation under climate change. Ecological Applications, 26(4), 1223-1237.