<?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: Looping the &amp;quot;Resample&amp;quot; operation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/looping-the-amp-amp-quot-resample-amp-amp-quot/m-p/398431#M31443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;your output contains 2 paths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;took the liberty and modified it a bit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy,os from arcpy import sa arcpy.gp.overwriteOutput=True arcpy.CheckOutExtension("spatial") import glob&amp;nbsp; Output="E:/test/New Folder" Input=glob.glob("E:/test/New Folder/*tif")&amp;nbsp; for i in Input: &amp;nbsp;&amp;nbsp;&amp;nbsp; outfile = "D:/Freelancer/oDesk/Create-ArcPy-Scripts/OutputFiles/" + os.path.split(i)[-1]&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Resample_management(i, outfile, "1000 1000", "BILINEAR")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Apr 2013 09:27:38 GMT</pubDate>
    <dc:creator>RaphaelR</dc:creator>
    <dc:date>2013-04-08T09:27:38Z</dc:date>
    <item>
      <title>Looping the &amp;amp;quot;Resample&amp;amp;quot; operation</title>
      <link>https://community.esri.com/t5/python-questions/looping-the-amp-amp-quot-resample-amp-amp-quot/m-p/398430#M31442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to resample multiple rasters with the "Resample_management" ArcPy function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code below works perfectly:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import sa arcpy.gp.overwriteOutput=True arcpy.CheckOutExtension("spatial") import glob&amp;nbsp; Input=glob.glob("D:\Freelancer\oDesk\Create-ArcPy-Scripts\TestFiles\*tif")&amp;nbsp; for i in Input: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Resample_management(i, i+"_1000.tif", "1000 1000", "BILINEAR")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it saves the output files in the same directory with the input ones. To change this, I modified it a bit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import sa arcpy.gp.overwriteOutput=True arcpy.CheckOutExtension("spatial") import glob&amp;nbsp; Output="D:/Freelancer/oDesk/Create-ArcPy-Scripts/OutputFiles/" Input=glob.glob("D:/Freelancer/oDesk/Create-ArcPy-Scripts/TestFiles/*tif")&amp;nbsp; for i in Input: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Resample_management(i, "'D:/Freelancer/oDesk/Create-ArcPy-Scripts/OutputFiles/%s_1000.tif' % i", "1000 1000", "BILINEAR")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But this throws an error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Traceback (most recent call last): &amp;nbsp; File "D:\Freelancer\oDesk\Create-ArcPy-Scripts\testscript-2.py", line 11, in &amp;lt;module&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Resample_management(i, "'D:/Freelancer/oDesk/Create-ArcPy-Scripts/OutputFiles/%s_1000.tif' % i", "1000 1000", "BILINEAR") &amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 12407, in Resample &amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: ERROR 999999: Error executing function. Failed to execute (Resample).&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I doing wrong?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 08:48:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/looping-the-amp-amp-quot-resample-amp-amp-quot/m-p/398430#M31442</guid>
      <dc:creator>ArditSulce</dc:creator>
      <dc:date>2013-04-08T08:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Looping the "Resample" operation</title>
      <link>https://community.esri.com/t5/python-questions/looping-the-amp-amp-quot-resample-amp-amp-quot/m-p/398431#M31443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;your output contains 2 paths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;took the liberty and modified it a bit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy,os from arcpy import sa arcpy.gp.overwriteOutput=True arcpy.CheckOutExtension("spatial") import glob&amp;nbsp; Output="E:/test/New Folder" Input=glob.glob("E:/test/New Folder/*tif")&amp;nbsp; for i in Input: &amp;nbsp;&amp;nbsp;&amp;nbsp; outfile = "D:/Freelancer/oDesk/Create-ArcPy-Scripts/OutputFiles/" + os.path.split(i)[-1]&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Resample_management(i, outfile, "1000 1000", "BILINEAR")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 09:27:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/looping-the-amp-amp-quot-resample-amp-amp-quot/m-p/398431#M31443</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2013-04-08T09:27:38Z</dc:date>
    </item>
  </channel>
</rss>

