I am trying to create a model in ModelBuilder (ArcMap 10.2.2), where there is an iteration through rasters in a workspace, each raster is run through a formula in raster calculator and where the output name is dependent on the raster name. As you can see in the picture, I have put an invariable output name %Name%, which should change with each iteration, with a new name coming from the new raster. This does not work however, only the first two iterations change the name, then all following iterations uses the first created namespace.
E.g.: If the raster file names are 'a' through 'c', the model will create raster a and b and then overwrite all following raster onto 'a' namespace, overwriting the data.
I have also tried using the %n% and %i% variables, with the same result.
I have put all rasters in a workspace (geodatabase) that is another than the the currently active one, using ArcCatalog Import-->Raster Datasets... in ArcMap window. The raster file names does only have text and numbers, no spaces or special characters.
Add.The problem with the model is that the generic variable "Workspace" don't work this way, see solution below
This post seems to have a somewhat similar problem, although it has not been resolved: Why does inline variable output overwrite occurs with Reorder fields tool?
- I have also tried to set 'Name' as a precondition for Raster calculator.
- I have been trying both running raster sets from Workspace (default and other geodatabase (gdb)) and from a Raster catalog, same results.
- This happens even if I use other tools such as Clip, with Workspace as input for rasters.
I am using the following paths:
input: E:\kaosmapp\Magdalena Bulks\NDVI calc\NDVI_images or E:\kaosmapp\Magdalena Bulks\NDVI calc\NDVI_calc.gdb (tried both)
output: E:\kaosmapp\Magdalena Bulks\NDVI calc\output\%Name%.tif
It gives the same result regardless if I add .tif or not for output file.