gisbert61

how to generate name of raster

Discussion created by gisbert61 on Dec 5, 2013
Latest reply on Dec 5, 2013 by gisbert61
Hello,

I'm developing a model in which I take two rasters as input, do some rastercalculation and produce a third raster.

As long as I provide a name for this resulting raster in the "output raster" field of the rastercalculator everything is fine.

Now I would like to automatically generate the name of the resulting raster from parts of both input names so later I can determine from the name which rasters were used as input. (All my input rasters have a strict name convention)

Basically I'm trying to generate a string which I can then use as inline variable in the output raster box of the rastercalculator, something along the lines of:
output1 = (value1[2:4]+value1[6:7]+value2[2:4]+value2[6:7])


First I've tried this with the model only tool "calculate value" but no succes, perhaps I cannot create a string using this tool?

Secondly I tried to write a scripttool which generates an output string from two inputs, seems  to work on itself but whatever I try I cannot get it accepted in the rastercalculator' output raster field. It's either ignored or I get the value '1' filled in

    Is there anybody who can point me towards what I'm missing here?
    Should a string work?
    Can I generate a string using 'calculate value'?
    Am I overlooking another tool which is capable of manipulating strings like I want?
    Should I avoid using strings altogether and think differently? (how?)
Any help is greatly appreciated (I'll mention you in my documentation :-)) and one day I hope to return the favor.

regards,

B

Outcomes