<?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: IDW interpolatation using ArcPy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124037#M9641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan Patterson. I edited my question according to the instructions that you posted. And yes I'm using python 2.7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2020 17:45:42 GMT</pubDate>
    <dc:creator>PedroMoreira</dc:creator>
    <dc:date>2020-08-03T17:45:42Z</dc:date>
    <item>
      <title>IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124035#M9639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;I have multiple point feature class (las_1.shp, &lt;SPAN&gt;las_2.shp&lt;/SPAN&gt;....._711) into one folder. I am trying to write a python script to perform&amp;nbsp;IDW interpolation which will loop all the point feature class and outraster will save as it name of input raster.&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Each Point feature class hold &amp;nbsp;one Z filed only (Altit).&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The problem is that after interpolation some of the generated raster are saved, however, with an error&lt;/SPAN&gt; (all black). I think that the problem is in the part of save the raster (os.path.join) because a execute the script without this part and the interpolation works perfectly. I'm using Python 2.7.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;SPAN&gt;Below is my script, what i have so far&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sa &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parallelProcessingFactor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"100%"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# settings&lt;/SPAN&gt;
env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\pedro\Documents\Mestrado\GEO\Pontos_Laser\TESTE"&lt;/SPAN&gt;
out_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\pedro\Documents\Mestrado\GEO\Pontos_Laser\RASTER"&lt;/SPAN&gt;
zField &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Altit"&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# has to be string, not list&lt;/SPAN&gt;

points &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFeatureClasses&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"las_*.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"POINT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; points

cellSize &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;
power &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;
searchRadius &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; RadiusVariable&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;12&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Check out the ArcGIS Spatial Analyst extension license&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Spatial"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Execute IDW&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fc &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; points&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; fc
    outIDW &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Idw&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; zField&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; cellSize&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; power&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; searchRadius&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Save output raster to output workspace&lt;/SPAN&gt;
    tifname &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fc&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;7&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    
    &lt;SPAN class="comment token"&gt;# Save output&lt;/SPAN&gt;
    IDW_OUT&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;out_folder&lt;SPAN class="punctuation 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;tifname&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; IDW_OUT
    outIDW&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IDW_OUT&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'done'&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;/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;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>Sat, 11 Dec 2021 07:06:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124035#M9639</guid>
      <dc:creator>PedroMoreira</dc:creator>
      <dc:date>2021-12-11T07:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124036#M9640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From your print statements, this must be in arcmap/python 2.7?&lt;/P&gt;&lt;P&gt;Also, your indentation is off and line numbers would be a help&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 16:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124036#M9640</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-03T16:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124037#M9641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan Patterson. I edited my question according to the instructions that you posted. And yes I'm using python 2.7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 17:45:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124037#M9641</guid>
      <dc:creator>PedroMoreira</dc:creator>
      <dc:date>2020-08-03T17:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124038#M9642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I edited your indentation and changed a line to print.&amp;nbsp; Can you give an example of the&amp;nbsp;print statements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 18:01:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124038#M9642</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-03T18:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124039#M9643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan Patterson, I just ran the script again to try it out. There is no error message, however, some rasters have negative values. All files have the same coordinate system and have the same field in relation to the "Z" attribute. I can't find why some files generate the raster correctly and others don't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 18:23:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124039#M9643</guid>
      <dc:creator>PedroMoreira</dc:creator>
      <dc:date>2020-08-03T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: IDW interpolatation using ArcPy</title>
      <link>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124040#M9644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know, That would depend on your inputs, their values, their location in space and a load of other things.&amp;nbsp; IDW only works with what it has, so you might want to examine your data to make sure that input points don't have negative values which represent nodata values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 20:12:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/idw-interpolatation-using-arcpy/m-p/124040#M9644</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-03T20:12:09Z</dc:date>
    </item>
  </channel>
</rss>

