inline variable substitution causing failure in ModelBuilder

1088
3
Jump to solution
10-12-2022 04:22 PM
PhilCrossley1
New Contributor III

I'm trying to build a simple model that prompts operators for an Input DEM, and a name to use for the model tool outputs, and to then run a simply avalanche proneness model (above snowline, certain aspects, steep slopes).  I'm using inline subsituttion to name each tool output with the Input Name....and it works fine for the first set of operations.  Then when I try to query the slope and aspect in the raster calculator, the slope raster name is interpreted as a string, rather than as raster data, and the tool/model fails.

Does anyone have any suggestions for how to get the second 'set' of model tools to recognize the outputs from the first tools as legitimate inputs?

I've attached the model and a screenshot of the error message I always get..

 

(II've also tried just iterating through the folder of DEMs, and with the same results/failure at the same point, where only the Name variable is read into the Raster Calculator, instead of the raster dataset it refers to)

0 Kudos
1 Solution

Accepted Solutions
PhilCrossley1
New Contributor III

Have figured out a work around, in case anyone's interested.  Instead of using the raster calculator, I was able to Reclassify by Table, and use the Remap table to specify the ranges of slopes and aspects that i wanted to preserve; and then instead of the Raster Calculator to combine all 3 parameters, used the "Times" tool (twice)....WIth those changes, I am able to use a "Name" variable  and in-line substitution throughout the whole model....the attachment shows just the part of the model that I added to the intial processes

View solution in original post

3 Replies
ABishop
MVP Regular Contributor

Hello Phil,

I don't have experience using inline variables or iteration for DEMS.  But just reading the 000539 Error message from python is calling out an issue with the ">=" operator in the field calculator.  Also, the calculation is attempting to add or concatenate a string or a number.

And did you see this thread:  https://community.esri.com/t5/arcgis-pro-questions/inline-variables-error-in-modelbuilder/m-p/112696... 

Amanda Bishop, GISP
0 Kudos
PhilCrossley1
New Contributor III

Thanks. Yes, the raster calculator is reading the 'in_raster" as a str because of the %Name% characters in the file name (as it appears in the Model, not in the actual file name), so it won't evaluate the expression...I had read the thread you linked to, but since the proposed solution was to use a completely different method to isolate the file name, I didn't think its relevant. Having written that, I'm going to rethink whether inserting that additional step might allow me to 'grab' the real file name in order to initiate the second set of analysis processes..............thx.

0 Kudos
PhilCrossley1
New Contributor III

Have figured out a work around, in case anyone's interested.  Instead of using the raster calculator, I was able to Reclassify by Table, and use the Remap table to specify the ranges of slopes and aspects that i wanted to preserve; and then instead of the Raster Calculator to combine all 3 parameters, used the "Times" tool (twice)....WIth those changes, I am able to use a "Name" variable  and in-line substitution throughout the whole model....the attachment shows just the part of the model that I added to the intial processes