Deleteing Feedback variable after use in Model Builder

812
5
07-12-2013 08:38 AM
DavidQuillin
New Contributor
I've build a model that uses feedback variables through X number of iterations within a for loop to manipulate a raster. Due to space limitations, I want to delete the previous variable after it has been used in the next iteration. For example, Raster-->Raster Calculator = Raster1-->Raster Calculator = Raster2--> Delete Raster1, Next iteration Raster2--> Raster Calculator = Raster3-->Delete Raster2 ...and so on, keeping the final iteration output.

Anyone got any experience putting something like this together?

Thanks
Dave
0 Kudos
5 Replies
ShitijMehta
Esri Regular Contributor
Hi,
Can you let the last output of the iteration that you want to delete and use in feedback be overwritten for each iteration rather than creating a new one per iteration? This way you don't need to delete all the outputs except the last. You can do this be leaving the last output name that is not unique for each iteration: c:\Temp\abc : This way the same abc gets created for every iteration.
0 Kudos
DavidQuillin
New Contributor
Thanks for the suggestion but I'm not sure how that would work since you would be overwriting the same input you would be using for that iteration.
0 Kudos
ShitijMehta
Esri Regular Contributor
Can you share a snapshot of the model you have created?
0 Kudos
DavidQuillin
New Contributor
Here you go.
0 Kudos
ShitijMehta
Esri Regular Contributor
Try this:
Write the output of the Raster Calculator to in_memory/outRaster%Value% (if your rasters are not too big) then add the Copy Raster tool after that. Connect the output of the raster calculator as input to the copy raster tool. Let the output of the copy raster be something like this: C:/Temp.gdb/CopyRaOut. Do not use %Value% her.

Let me know if this works for you,
0 Kudos