AnsweredAssumed Answered

Problem in saving  output raster in a specific output folder with correct name

Question asked by india123 on Oct 1, 2016
Latest reply on Oct 1, 2016 by Dan_Patterson

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.workspace = 'D:\MODIS_SURFACE_RF2012\EVI'
out_ws = 'D:\MODIS_SURFACE_RF2012\EVI1'
rasters = arcpy.ListRasters()
rastersCount = len(rasters)
counter = 0
dek = 1

# compute dekad rasters
while counter < rastersCount:
    dekad = []
    for i in range(counter,(counter+4)):
        print i
        dekad.append(rasters[i])
        outCellStatistics = CellStatistics(dekad, "MEAN", "NODATA")
        outRasterName = out_ws + 'r{:03d}_EVI.tif'.format (dek)
        #outRasterName = "00" + str(dek) + ".tif"
        outCellStatistics.save(outRasterName)
    counter += 4
    dek += 1

Outcomes