I have multiple point feature class (las_1.shp, las_2.shp....._711) into one folder. I am trying to write a python script to perform IDW interpolation which will loop all the point feature class and outraster will save as it name of input raster.
Each Point feature class hold one Z filed only (Altit).
The problem is that after interpolation some of the generated raster are saved, however, with an error (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.
Below is my script, what i have so far
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">from</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>sa <SPAN class="keyword token">import</SPAN> <SPAN class="operator token">*</SPAN>
<SPAN class="keyword token">import</SPAN> os
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>parallelProcessingFactor <SPAN class="operator token">=</SPAN> <SPAN class="string token">"100%"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="comment token"># settings</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\Users\pedro\Documents\Mestrado\GEO\Pontos_Laser\TESTE"</SPAN>
out_folder <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\Users\pedro\Documents\Mestrado\GEO\Pontos_Laser\RASTER"</SPAN>
zField <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Altit"</SPAN> <SPAN class="comment token"># has to be string, not list</SPAN>
points <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"las_*.shp"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"POINT"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> points
cellSize <SPAN class="operator token">=</SPAN> <SPAN class="number token">5</SPAN>
power <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN>
searchRadius <SPAN class="operator token">=</SPAN> RadiusVariable<SPAN class="punctuation token">(</SPAN><SPAN class="number token">12</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">5</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Check out the ArcGIS Spatial Analyst extension license</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CheckOutExtension<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Spatial"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Execute IDW</SPAN>
<SPAN class="keyword token">for</SPAN> fc <SPAN class="keyword token">in</SPAN> points<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> fc
outIDW <SPAN class="operator token">=</SPAN> Idw<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN> zField<SPAN class="punctuation token">,</SPAN> cellSize<SPAN class="punctuation token">,</SPAN> power<SPAN class="punctuation token">,</SPAN> searchRadius<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Save output raster to output workspace</SPAN>
tifname <SPAN class="operator token">=</SPAN> fc<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">7</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="comment token"># Save output</SPAN>
IDW_OUT<SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>out_folder<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'{}.tif'</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>tifname<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> IDW_OUT
outIDW<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN>IDW_OUT<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">'done'</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>