<?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 Re: Setting script output parameter in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/setting-script-output-parameter-in-python/m-p/673770#M52108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;[Resolved]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it can help someone:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
h = int(arcpy.GetParameterAsText(0))

if h &amp;gt;= 6 and h &amp;lt; 12:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Morning")
elif h &amp;gt;= 12 and h &amp;lt; 18:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Afternoon")
elif h &amp;gt;= 18 and h &amp;lt; 23:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Evening")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Night")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And don't forget to check if you have to put the output parameter type as "derived" in the parameter proprieties.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm interested in any better (faster?) solution, though...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Happy arcgising&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:25:42 GMT</pubDate>
    <dc:creator>MarcFasel</dc:creator>
    <dc:date>2021-12-12T04:25:42Z</dc:date>
    <item>
      <title>Setting script output parameter in Python</title>
      <link>https://community.esri.com/t5/python-questions/setting-script-output-parameter-in-python/m-p/673769#M52107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working on a simple model (see picture attached) that, basically, takes a location and an hour as inputs and deliver a IDW predicted value (e.g. 2375.54) as output based on the cell values of rasters stored in a geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are four rasters stored, one for each period of the day (morning, afternoon, evening and night).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added a Python script aimed to change the name of the raster to use by the model tools according to the hour given in parameter. For example if hour = 7 the tools should use the "Morning" raster to make the prediction. If hour = 15 = 3pm, it should use the afternoon raster and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The model works fine if I set all the input and output parameters manually, but I can't figure out how to change dynamically the name of the raster the model has to work with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What would be the best way to switch dynamically between rasters in this kind of model?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help or suggestion..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 13:00:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-script-output-parameter-in-python/m-p/673769#M52107</guid>
      <dc:creator>MarcFasel</dc:creator>
      <dc:date>2011-03-07T13:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Setting script output parameter in Python</title>
      <link>https://community.esri.com/t5/python-questions/setting-script-output-parameter-in-python/m-p/673770#M52108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;[Resolved]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it can help someone:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
h = int(arcpy.GetParameterAsText(0))

if h &amp;gt;= 6 and h &amp;lt; 12:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Morning")
elif h &amp;gt;= 12 and h &amp;lt; 18:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Afternoon")
elif h &amp;gt;= 18 and h &amp;lt; 23:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Evening")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, "Raster_Night")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And don't forget to check if you have to put the output parameter type as "derived" in the parameter proprieties.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm interested in any better (faster?) solution, though...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Happy arcgising&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:25:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/setting-script-output-parameter-in-python/m-p/673770#M52108</guid>
      <dc:creator>MarcFasel</dc:creator>
      <dc:date>2021-12-12T04:25:42Z</dc:date>
    </item>
  </channel>
</rss>

