AnsweredAssumed Answered

automate raster extraction and saving data based on input raster

Question asked by sean.woznicki on Jul 21, 2014
Latest reply on Jul 28, 2014 by sean.woznicki

Hi ,

I have 70 raster files and I want to make 3 new raster from each of the 70 raster. For that, I want to automate the process using python script and store the output new raster based on the raster file name plus value field. For example, My input raster is  01367620-r-r and 3 value fields are 9,11, and 13. So the output folder should be 01367620-r-r-9. 01367620-r-r-11, and 01367620-r-r-13. When I ran my code, I got the below error message. I think, I am doing mistake at "outname=os.path.join(outws,str(i), str(j))" in my code. I would appreciate your suggestion/input.


Error Message:

Traceback (most recent call last):

  File "C:/Subhasis/Test/Neshanic_Python/", line 23, in <module>

RuntimeError: ERROR 000875: Output raster: C:\Subhasis\Test\Neshanic_Python\extract\01367620-r-r\9's workspace is an invalid output workspace.


I am providing my code below.

import arcpy, os

from arcpy import env

from import *


#To overwrite output

arcpy.env.overwriteOutput = True


#Set environment settings

env.workspace = "C:/Subhasis/Test/Neshanic_Python"




#checkout ArcGIS spatial analyst extension license



# set local variable

inraster = ["01367620-r-r"]

for i in inraster:


    for j in STI_list:

        attExtract = ExtractByAttributes(str(i), "VALUE>=" + str(j))

        outname=os.path.join(outws,str(i), str(j))