Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Reclassification of raster

$
0
0

Is there a better way to do this?

I’m trying to create a script that will change classifications of a raster to:

0 for: 0,7-9,15-20,40,62-63,73,78-87,89-130,132-151,153-175,177-203,215,228,251-253

1 for: all others

#RECLASSIFY LANDCOVER
#Considers 0 for:  63,81-83,87,111-112,121-124,141-143,190,195,     
#Considers 1 for:  All others.
#Considers "NODATA" for:  background, blank
import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = r'C:ErosionLandCover'
outReclass1 = Reclassify("CDL_2014.tif", "Value", 
                         RemapRange([[0,0,"NODATA"],[7,9,"NODATA"],[15,20,"NODATA"],[40,40,"NODATA"],
                                     [62,62,"NODATA"],[63,63,0],[73,73,"NODATA"],[78,80,"NODATA"],[81,83,0],
                                     [84,86,"NODATA"],[87,87,0],[89,91,"NODATA"],[93,110,"NODATA"],[111,112,0],
                                     [113,120,"NODATA"],[121,124,0],[125,130,"NODATA"],[132,140,"NODATA"],
                                     [141,143,0],[144,151,"NODATA"],[153,175,"NODATA"],[177,189,"NODATA"],
                                     [190,190,0],[191,194,"NODATA"],[195,195,0],[196,203,"NODATA"],
                                     [215,215,"NODATA"],[228,228,"NODATA"],[251,253,"NODATA"]]), 1)
outReclass1.save(r'C:ErosionOutputCDL_reclass.tif')

I was attempting to modify the script from the ArcGIS Resource Center Desktop Help.


Viewing all articles
Browse latest Browse all 767

Trending Articles