I am trying to save output raster in out_ws folder path with name r001_EVI, r002_EVI so on... but output raster goes to the main folder (MODIS_SURFACE_RF2012) with such output name rEVI_001_EVI.
How to link it with desire location with output name e.g r001_EVI, r002_EVI so on.
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> <SPAN class="string token">'D:\MODIS_SURFACE_RF2012\EVI'</SPAN>
out_ws <SPAN class="operator token">=</SPAN> <SPAN class="string token">'D:\MODIS_SURFACE_RF2012\EVI1'</SPAN>
rasters <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListRasters<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
rastersCount <SPAN class="operator token">=</SPAN> len<SPAN class="punctuation token">(</SPAN>rasters<SPAN class="punctuation token">)</SPAN>
counter <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
dek <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN>
<SPAN class="comment token"># compute dekad rasters</SPAN>
<SPAN class="keyword token">while</SPAN> counter <SPAN class="operator token"><</SPAN> rastersCount<SPAN class="punctuation token">:</SPAN>
dekad <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">for</SPAN> i <SPAN class="keyword token">in</SPAN> range<SPAN class="punctuation token">(</SPAN>counter<SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">(</SPAN>counter<SPAN class="operator token">+</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> i
dekad<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>rasters<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
outCellStatistics <SPAN class="operator token">=</SPAN> CellStatistics<SPAN class="punctuation token">(</SPAN>dekad<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MEAN"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NODATA"</SPAN><SPAN class="punctuation token">)</SPAN>
outRasterName <SPAN class="operator token">=</SPAN> out_ws <SPAN class="operator token">+</SPAN> <SPAN class="string token">'r{:03d}_EVI.tif'</SPAN><SPAN class="punctuation token">.</SPAN>format <SPAN class="punctuation token">(</SPAN>dek<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#outRasterName = "00" + str(dek) + ".tif"</SPAN>
outCellStatistics<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN>outRasterName<SPAN class="punctuation token">)</SPAN>
counter <SPAN class="operator token">+=</SPAN> <SPAN class="number token">4</SPAN>
dek <SPAN class="operator token">+=</SPAN> <SPAN class="number token">1</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>