I have digital elevation models clipped to watershed boundaries and I have to run a set of tools to hydrologically condition each one, and I want to use the iterator tool to automate this process.
Each DEM starts in a unique folder with the HUC 10 code, and each time I run the model, I want all the outputs to go into the unique folder that the DEM started in. Then, when the model iterates through to the next DEM, I want all of those output files to go in that unique folder. I have the recursive option in the iterator parameters checked so it will iterate through each subfolder, but I am having trouble figuring out how to set up the output so that each output file goes into the same folder that the original input came from.
Is there some sort of coding that I need to put in the output name for each tool? Something along the lines of %____%DEMfel.tif? I'm familiar with %n% and %scratchworkspace% but those don't work for me because it puts all the output files into one single folder.
I tried referring to this post, but that did not work for me: Iterating in ModelBuilder to Generate Output Files in Source Folder?