Model Builder Iterator overwriting name error?????

4866
14
10-16-2015 09:35 AM
JustinMeyers
New Contributor III

I set up a model to iterate rasters and do a spatial analyst math int geoprocess.  i did a subset of my entire raster collection just to make sure it would work.  I have three rasters in a FGDB.  My output only had two rasters?  so I reran and had a different output.  same results.  I renamed the input rasters, same result?  Essentially the iterate is grabbing the last raster and naming the output the same as the first rasters output?????  Why is this happening?  See circled red boxes for exactly what is happening

0 Kudos
14 Replies
KyleBalke__GISP
Occasional Contributor III

The model worked for me as-is also, my only suggestion in addition to those by Zachary is to make the Name variable a precondition to the Int tool.

0 Kudos
JustinMeyers
New Contributor III

updated both preconditions you have suggested - renamed to Output_FGDB - still the same results.  not sure how we can be running the same model and have mine give me bad results??? - restarted my machine (sometimes esri software needs that) - nothing.  one of those things that is very straight forward and the software gives you bogus results (bang your head against the wall to figure out but can't).  nothing like this to finish the work week...  GDF software....  thanks for your ideas.

0 Kudos
ZacharyHart
Occasional Contributor III

create a new model as I have as mine is created, including the name change. Validate, and save. Run from catalog window. Just try recreating this (humor me, its a short model and shouldn't take long to rebuild).

KyleBalke__GISP
Occasional Contributor III

Justin...time to go home and have a beer.  It will work on Monday

0 Kudos
DarrenWiens2
MVP Honored Contributor

It appears that this is a bug in 10.2.1 and 10.2.2. See here (if Curtis Price​ can't figure it out, neither will I).

Your model works exactly as you report for me, at 10.2.2. None of the above solutions worked for me. What version are you using?

Luckily, the Python alternative is quite straightforward, something like:

>>> arcpy.CheckOutExtension("Spatial")
... arcpy.env.workspace = arcpy.GetParameterAsText(0) # input workspace parameter
... outFolder = arcpy.GetParameterAsText(1) # output workspace parameter
... rasters = arcpy.ListRasters()
... for raster in rasters:
...     outRas = arcpy.sa.Int(raster)
...     outRas.save(outFolder + '/' + raster)
0 Kudos