<?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: Generating new output names after each iteration in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840338#M3504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;perhaps&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

counter &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;

shp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"test.shp"&lt;/SPAN&gt;

pth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\s\Desktop\test\out\masked"&lt;/SPAN&gt;

out &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}\\{}{}.tif"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pth&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; shp&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; counter&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

out
&lt;SPAN class="string token"&gt;'C:\\Users\\s\\Desktop\\test\\out\\masked\\test100.tif'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:15:14 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-12T10:15:14Z</dc:date>
    <item>
      <title>Generating new output names after each iteration</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840335#M3501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write a script that will take a look at a list of county boundaries and then take each boundary and use it as a mask on a raster so that I can do Extract By Mask. Ideally I would like to have the county names on the output but I cannot figure out a way to do that, but any unique name at this point would do. Here is the script that I use:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import os&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy.sa import *&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; env.workspace = "C:/Users/s/Desktop/S/test"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; inRaster = "escrec"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; counter = 1&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; ctyList = arcpy.ListFeatureClasses ("*.shp")&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; for shp in ctyList:&lt;BR /&gt;... out = arcpy.sa.ExtractByMask(inRaster,shp)&lt;BR /&gt;... out.save("C:/Users/s/Desktop/test/out/masked"+ counter)&lt;BR /&gt;... counter = counter+2&lt;BR /&gt;...&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;I tried using this counter thing but it doesn't work due to concatenate issue (str and numbers). Anyone has any suggestions or tricks that they have done? I tried setting the counter as my "ctyList" but since feature have .shp it doesn't allow that to save.&lt;/P&gt;&lt;P&gt;extract by mask‌&amp;nbsp;acrpy#&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2018 21:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840335#M3501</guid>
      <dc:creator>Sam_Roodbar</dc:creator>
      <dc:date>2018-12-06T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Generating new output names after each iteration</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840336#M3502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;out.save(r"C:\Users\s\Desktop\test\out\masked"+ str(counter) + ".tif")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2018 22:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840336#M3502</guid>
      <dc:creator>SteveLynch</dc:creator>
      <dc:date>2018-12-06T22:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Generating new output names after each iteration</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840337#M3503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, I tried it and it works but the names of outputs were strange.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I specified counter as 01001 (for the first county) but the outputs started 513!!&lt;/P&gt;&lt;P&gt;is there a way to have the name of the shp s for output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2018 22:51:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840337#M3503</guid>
      <dc:creator>Sam_Roodbar</dc:creator>
      <dc:date>2018-12-06T22:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Generating new output names after each iteration</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840338#M3504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;perhaps&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;

counter &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;

shp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"test.shp"&lt;/SPAN&gt;

pth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\s\Desktop\test\out\masked"&lt;/SPAN&gt;

out &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{}\\{}{}.tif"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pth&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; shp&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; counter&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

out
&lt;SPAN class="string token"&gt;'C:\\Users\\s\\Desktop\\test\\out\\masked\\test100.tif'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840338#M3504</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T10:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Generating new output names after each iteration</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840339#M3505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I worked out another way to do the same, much easier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import os&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; from arcpy import env&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; env.workspace = "C:\XXX"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; ctyList = arcpy.ListFeatureClasses ("*.shp")&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; inRaster = "nlcdrecmosaic"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; for shp in ctyList:&lt;BR /&gt;... CtyName = shp.split('.')[0]&lt;BR /&gt;... out= arcpy.sa.ExtractByMask(inRaster,shp)&lt;BR /&gt;... out.save("C:\XXX\out\mskd"+ CtyName)&lt;BR /&gt;... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Dec 2018 19:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/generating-new-output-names-after-each-iteration/m-p/840339#M3505</guid>
      <dc:creator>Sam_Roodbar</dc:creator>
      <dc:date>2018-12-17T19:13:31Z</dc:date>
    </item>
  </channel>
</rss>

