I am trying to reclassify a raster, using arcpy in Python. My code is below
from osgeo import gdal
import arcpy
from arcpy import env
from arcpy.sa import *
raster_file = 'M:/tgopalakrishna\Data\CONUS_def_001_in_020\CONUS_def_001_in_020.tif'
#Opening the raster file
dataset = gdal.Open(raster_file)
band = dataset.GetRasterBand(1)
print band
#Reading the raster properties
projectionfrom = dataset.GetProjection()
print projectionfrom
geotransform = dataset.GetGeoTransform()
print geotransform
block_sizes = band.GetBlockSize()
x_block_size = block_sizes[0]
print x_block_size
y_block_size = block_sizes[1]
print y_block_size
xsize = band.XSize
print xsize
ysize = band.YSize
print ysize
max_value = band.GetMaximum()
print max_value
min_value = band.GetMinimum()
print min_value
stats= band.GetStatistics(0,1)
print stats # prints min, max, mean and std
# Set local variables
reclassField = "VALUE"
remap = RemapRange([0,999,1])
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
outReclassify = Reclassify(raster_file, reclassField, remap, "NODATA")
outReclassify.save("M:/tgopalakrishna\Outputs\Defended_state/trial.tif")
The errors I get are
Traceback (most recent call last): File "*************trial.py", line 41, in remap = RemapRange([0,999,1])
File "D:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\ParameterClasses.py", line 1160, in init _Remap.init(self, remapTable)
File "D:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\ParameterClasses.py", line 1129, in init self.remapTable = [list(record) for record in remapTable]
TypeError: 'int' object is not iterable
So clearly, there is something wrong with the range of the reclassification. How do I solve this?