<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to generate name of raster in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/how-to-generate-name-of-raster/m-p/170258#M5701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm developing a model in which I take two rasters as input, do some rastercalculation and produce a third raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As long as I provide a name for this resulting raster in the "output raster" field of the rastercalculator everything is fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;output1 = (value1[2:4]+value1[6:7]+value2[2:4]+value2[6:7])&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First I've tried this with the model only tool "calculate value" but no succes, perhaps I cannot create a string using this tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Secondly I tried to write a scripttool which generates an output string from two inputs, seems&amp;nbsp; 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&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;Is there anybody who can point me towards what I'm missing here?&lt;/UL&gt;&lt;UL&gt;Should a string work?&lt;/UL&gt;&lt;UL&gt;Can I generate a string using 'calculate value'?&lt;/UL&gt;&lt;UL&gt;Am I overlooking another tool which is capable of manipulating strings like I want?&lt;/UL&gt;&lt;UL&gt;Should I avoid using strings altogether and think differently? (how?)&lt;/UL&gt;&lt;SPAN&gt;Any help is greatly appreciated (I'll mention you in my documentation :-)) and one day I hope to return the favor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;B&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Dec 2013 08:21:14 GMT</pubDate>
    <dc:creator>Gisbert61</dc:creator>
    <dc:date>2013-12-05T08:21:14Z</dc:date>
    <item>
      <title>how to generate name of raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-generate-name-of-raster/m-p/170258#M5701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm developing a model in which I take two rasters as input, do some rastercalculation and produce a third raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As long as I provide a name for this resulting raster in the "output raster" field of the rastercalculator everything is fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;output1 = (value1[2:4]+value1[6:7]+value2[2:4]+value2[6:7])&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First I've tried this with the model only tool "calculate value" but no succes, perhaps I cannot create a string using this tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Secondly I tried to write a scripttool which generates an output string from two inputs, seems&amp;nbsp; 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&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;Is there anybody who can point me towards what I'm missing here?&lt;/UL&gt;&lt;UL&gt;Should a string work?&lt;/UL&gt;&lt;UL&gt;Can I generate a string using 'calculate value'?&lt;/UL&gt;&lt;UL&gt;Am I overlooking another tool which is capable of manipulating strings like I want?&lt;/UL&gt;&lt;UL&gt;Should I avoid using strings altogether and think differently? (how?)&lt;/UL&gt;&lt;SPAN&gt;Any help is greatly appreciated (I'll mention you in my documentation :-)) and one day I hope to return the favor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;B&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 08:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-generate-name-of-raster/m-p/170258#M5701</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2013-12-05T08:21:14Z</dc:date>
    </item>
    <item>
      <title>SOLVED: how to generate name of raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-generate-name-of-raster/m-p/170259#M5702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Took some time but here is my solution using 'Calculate Value':&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]29608[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using 'parse path' and choosing NAME I get two strings in Value1 and Value2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These are both preconditional for the 'calculate value'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pay ATTENTION to the double quotes around the %variables% in the expression; they costed me most of the day &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So the expression is: &lt;/SPAN&gt;&lt;PRE&gt;x(&lt;STRONG&gt;"&lt;/STRONG&gt;%Value1%&lt;STRONG&gt;"&lt;/STRONG&gt;, &lt;STRONG&gt;"&lt;/STRONG&gt;%Value2%&lt;STRONG&gt;"&lt;/STRONG&gt;)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code block concatenates some parts of the original names into a decriptive name which is used to name the resulting raster (example above is from a test model which doesn't do much beside create the output_value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Works like a charm, hope this will be helpful for someone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Dec 2013 13:07:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-generate-name-of-raster/m-p/170259#M5702</guid>
      <dc:creator>Gisbert61</dc:creator>
      <dc:date>2013-12-05T13:07:14Z</dc:date>
    </item>
  </channel>
</rss>

