Reproducible problem with raster iterator missing one file when using any tools in model builder.

1106
2
Jump to solution
02-12-2019 09:20 PM
LochlanJones
New Contributor III

I am trying to run various tools on a large number of rasters beginning with Project Raster but the last raster is always missed and so the output has one less raster in it. The model appears to run successfully with no errors given. All rasters were previously defined successfully using the raster iterator.

Below is my model I am using to project my rasters and also convert them from ASCII to Esri Grid in the process. Because I want to maintain the names of the rasters I am using in-line substitution. Normally I would use the %name% in-line substitution but this also includes the .asc file extension which prevents converting to Esri Grid as this output format is specified by a lack of an extension. So instead I am using Parse Path with name chosen as the Parse Type so that %value% can be used as in-line substitution for the original file name without the extension. 

All seems well at this point, but when I run the model all but the last raster are output by the model (all rasters are named with four numbers, e.g. 1457). I was able to successfully project the missing rasters individually but then I discovered that all the rasters outputted by the model had been given the wrong names. It seems that the name is applied to raster that's next on the list instead of the actual raster it belongs to.

Biggest clue I've found so far is that it only occurs when using Parse Path. But as I mentioned above, if I just use %name% without Parse Path I won't be able to convert to Esri Grid, and if I choose another format such as TIFF my file names will be exampleraster.asc.tif which causes more problems down the line because of the double file extension.

I have been able to reproduce this problem with multiple folders of rasters and when I remove the 'problem raster' that was skipped and run the model again it then repeats the problem again and skips the next last raster. The same issue occurs with other tools I need to use such as Raster to Polygon. I have had the exact same problem using ArcMap 10.6.1 and 10.4.1.

Not sure if this is useful or not but the problem doesn't occur if the folder only contains one raster, but does occur when it contains two.

Summary:

  • Trying to project multiple raster in one folder using iterate rasters in Model Builder.
  • Original files in ASCII format.
  • Output in Esri Grid
  • Prior to this step all rasters were defined using raster iterator.
  • Using in-line substitution to maintain original raster names.
  • Model runs successfully with no errors or obvious issues.
  • Last raster missing from output and other rasters have been misnamed - all names applied to next raster in line instead.
  • Issue is reproducible for other data, other tools, and across multiple versions of ArcMap (10.6.1 and 10.4.1).
  • Issue only occurs when using Parse Path

Does anyone know what might be going on or any workarounds? I am a relative beginner to GIS so I have no experience with Python at present but I suspect I may have to teach myself soon.

0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

Try making the output of parse path a precondition to your project raster tool. This means you want parse path tool to run before the project raster tool.

View solution in original post

2 Replies
DuncanHornby
MVP Notable Contributor

Try making the output of parse path a precondition to your project raster tool. This means you want parse path tool to run before the project raster tool.

curtvprice
MVP Esteemed Contributor

I am sure this is right on, especially because of MY candidate for the biggest clue:

It seems that the name is applied to raster that's next on the list instead of the actual raster it belongs to.

0 Kudos