AnsweredAssumed Answered

raster extraction

Question asked by sean.woznicki on Feb 25, 2016
Latest reply on Feb 26, 2016 by slynch-esristaff

I have a original tif file which has values from 2 to 28. From that original tif file, I am extracting cells having value >=10 using the following code. The code is working. However, when I open the new extracted tif file in GIS, I found that the cell values range from 10 30 instead of 10 to 28. I would really appreciate any help/ suggestion!   

The code is provided below:

import arcpy, os

from arcpy import env

from import *


#To overwrite output

arcpy.env.overwriteOutput = True


#Set environment settings

env.workspace = "C:/Subhasis/Highland/Project/Python_data"




#checkout ArcGIS spatial analyst extension license



inraster = arcpy.ListRasters("*", "TIF")



for i in inraster:

    flds = ("VALUE", "COUNT") 

    dct = {row[0]:row[1] for row in arcpy.da.SearchCursor(i, flds)} 

    sumcnt = sum(dct.values())

    dct1 = {k:v for (k,v) in dct.items() if k >= 10}

    sumcnt1 = sum(dct1.values())


    print i,percentage

    newraster = ExtractByAttributes(str(i), "VALUE>=10")