Select to view content in your preferred language

Raster input using inline variable substitution

3409
2
08-05-2015 01:28 PM
DerrickKo_Heinrichs
Deactivated User

I'm trying to figure out why I can't point to a raster as input (for pan sharpening) using inline variable substitution? I have no problem using inline variable sub as part of the output raster name.

I'm using ModelBuilder to iterating over a collection of multispectral rasters to be fed into the pansharpen tool. I'm using inline variable sub for the pan image input (actually as input into Make Raster Layer first):

D:\SomePath\%PanImageName%.tif

where %PanImageName% is the name of the Pan image that matches the current Multispectral image being processed by the Iterate Raster tool. 

To hopefully be more clear, the Name variable coming off the Iterate Raster tool is passed through the Calculate Value tool with this expression... "%Name%".replace("m20","p10_1"), giving me the value PanImageName used to identify the matching pan image.

I have added preconditions where the seemed necessary, but I just can't figure this one out.

I get the following error:

ERROR 000732

Panchromatic Image: Dataset D:\SomePath\%PanImageName%.tif does not exist or is not supported.

Hoping somebody can help, thanks!

0 Kudos
2 Replies
ChrisDonohue__GISP
MVP Alum

I'm not exactly sure what is causing the issue, but this is a good starting point.

Here's ESRI's explanation for the error:

35151 - 000732: Dataset does not exist or is not supported

If you haven't tried them, look into their suggestions - maybe that will clear things up?

Chris Donohue, GISP

DerrickKo_Heinrichs
Deactivated User

Thanks Chris.

I found a solution! Despite searching thoroughly before posting, I hadn't seen the following:

https://community.esri.com/message/80678#80678

I applied the advice in the last comment.

I dropped the "Pan_Input" variable described and illustrated in my original post. Instead, I modified the expression in "Calculate Value (1)" from "%Name%".replace("m20","p10_1") to "D:\SomePath\%Name%".replace("m20","p10_1") and changed the data type from string to Raster Dataset. Lastly, the output of "Calculate Value (1)" was the direct input into the pan sharpen tool.

Revised_IterateRasters_PanSharpen.PNG