Select to view content in your preferred language

Model Builder/Raster calculator: link output raster as input for raster calculator

2817
7
03-29-2013 10:20 AM
YvanStg
Deactivated User
Hello,

(I have been trying to see if this type of problem had already been resolved in the forum, but I can't find an existing thread about it. Please feel free to redirect me if this issue has been answered many times before.)

I am using Model Builder in ArcGIS Desktop 10.

In order to convert HDFs into ArcGIS rasters, I need to finish my model with a conversion from 16-bit integers to values in Celsius degrees. The equation for that is: float("raster_name") * 0.075 - 3
I have used this equation in RasterCalculator for single HDF files before but now I would like to integrate the RasterCalculator tool into my model.

However, I can't figure out how to link the output raster from the previous tool to RasterCalculator.
So far my model looks like:
Input raster -> PrepareSSTData (tool) -> Output Raster   ->   ?   -> RasterCalculator (with MAexpression) -> Output raster(2)



Is there a way to do that in Model Builder ? or should I find another way ?

Thanks a lot,
Yvan
0 Kudos
7 Replies
curtvprice
MVP Esteemed Contributor
So far my model looks like:
Input raster -> PrepareSSTData (tool) -> Output Raster   ->   ?   -> RasterCalculator (with MAexpression) -> Output raster(2)

Is there a way to [connect Output Raster to Raster Calculator] in Model Builder?


Raster Calculator accepts raster layer inputs -- so if you open the Raster Calculator tool inside ModelBuilder you should see "Output Raster" in the pick list to use in expressions. Is it not there?
0 Kudos
YvanStg
Deactivated User
Hi Curtis,

thanks a lot for your reply.

I do see the Raster Output in the pick-list but the tool does not work.
Here is what I do :
In Model Builder, I'm connecting Output Raster to the Raster Calculator tool using the "Precondition" connection. I use this kind of connection because the only other options for the connection are "Map algebra expression" which is not right or the "Environments" kind of connections, which is not what want I want either.
Once I have Output Raster and Raster Calculator connected (it uses a dashed line), I can see Output raster in the Calculator pick-list. I use it to write my expression.
However, when I want to use the model, just after I click the OK button I get an error pop-up window even before the model starts running :
"The value is empty.
ERROR 000735: ArcGIS raster: Value is required." which, I think, is referring to the Output Raster.

Any clue about that ?

Regards,
Yvan

PS: I attached a screenshot of the model as I have it. On top is a previous step that converts the HDF file to a raster. This part works fine by itself.
[ATTACH=CONFIG]23299[/ATTACH]
0 Kudos
curtvprice
MVP Esteemed Contributor
Are you sure your script tool is returning a variable of type Raster Dataset? I think the problem is with the validation...

This is how raster calculator looks to me when I have a raster data element in the model:

[ATTACH=CONFIG]23304[/ATTACH]

If Output raster is in the list, it's not necessarily a raster dataset.

if you can't get your script tool to return a variable of type raster dataset, workarounds I can think of are -

Connect your Output Raster to the Make Raster Layer tool and try to use that in Map Algebra (you may get the same error from that tool)

Use Calculate Value (CV) to convert the variable contents (say, a path string) to a raster dataset - use the CV expression: r"%Output raster%" and set the output Data Type to Raster Dataset.
0 Kudos
YvanStg
Deactivated User
Yeah, that how it looks for me too.
On your picture, you don't connect the Raster Dataset to Raster Calculator tool. Is that the way it should be ? or is it just because you wanted to show me the pick-list and you didn't need to connected them properly ?

[ATTACH=CONFIG]23305[/ATTACH]

Yvan
0 Kudos
YvanStg
Deactivated User
I just saw that you had edited your previous post.

I thought that, as you said, the problem might be that the Output Raster is not a raster dataset. Unfortunately, it seems to be (see picture).[ATTACH=CONFIG]23311[/ATTACH]

Now, I've tried both options:
- use Make Raster tool then Raster Calculator. Same problem.
- use CV then Raster Calculator. Same problem.

I guess I'll have to use Raster calculator separately, outside of the model I want to build.

Thanks for your help Curtis.

Best,
Yvan
0 Kudos
curtvprice
MVP Esteemed Contributor
Your attachment does not display.

If the data type of "Output raster" is Raster Dataset or Raster Layer, the next thing I'd check is its content. You may have to modify your script so it will return a value (raster dataset pathname?) that tools can recognize. (Note that since Make Raster layer did not work either, this isn't a problem with the Raster Calculator tool; it's with the value or type of Output raster.

Hope this helps!

UPDATE: I found the tool you are using, from the Marine Geospatial Ecology tools:
Convert SDS in HDF to ArcGIS Raster

I saw that the current version of this tool has a map algebra expression argument you can use. Maybe if you do it that way you can get this thing iterating as you wish!
0 Kudos
YvanStg
Deactivated User
Yeah, sorry, the tool I use is from the MGET toolbox. I'm trying the most recent version now, but I seem to have a problem with it too.
I think I'll contact them to see if they have any idea of what could be wrong.

Thanks for your help !

Yvan
0 Kudos