5

I am trying to reclassify DEM using arcpy.sa.Reclassify and it is showing an error.

Following are my commands:

dem_re=arcpy.sa.Reclassify("dem_extfish.tif","VALUE",arcpy.sa.RemapRange([[391, 677, 1],[677, 963, 2],[963, 1249, 3],[1249, 1535, 4],[1535, 1821, 5],[1821, 2107, 6],[2107, 2393, 7],[2393, 2679, 8],[2679, 2965, 9],[2965, 3242,10]]))
dem_re.save("reclass_dem_eleband.tif")

The above command gives the error:

ExecuteError: ERROR 999999: Error executing function.
Failed to execute (Reclassify).

However, it was reclassified using ArcMap but have been producing the error with ArcPy.

The full error and traceback are as below:

ExecuteError Traceback (most recent call last)
<ipython-input-39-d371dde30892> in <module>()
----> 1 dem_re=arcpy.sa.Reclassify("dem_extfish.tif","VALUE",arcpy.sa.RemapRange([[391, 677, 1],[677, 963, 2],[963, 1249, 3],[1249, 1535, 4],[1535, 1821, 5],[1821, 2107, 6],[2107, 2393, 7],[2393, 2679, 8],[2679, 2965, 9],[2965, 3242,10]]))
C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Functions.py in Reclassify(in_raster, reclass_field, remap, missing_values)
 5751 reclass_field,
 5752 remap,
-> 5753 missing_values)
 5754 Reclassify.__esri_toolname__ = "Reclassify_sa"
 5755 Reclassify.__esri_toolinfo__ = [
C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Utils.py in swapper(*args, **kwargs)
 51 
 52 try:
---> 53 result = wrapper(*args, **kwargs)
 54 finally:
 55 # Reset the geoprocessor state to the original setting.
C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\sa\Functions.py in Wrapper(in_raster, reclass_field, remap, missing_values)
 5745 remap,
 5746 out_raster,
-> 5747 missing_values)
 5748 return _wrapToolRaster(u"Reclassify_sa", unicode(result.getOutput(0)))
 5749 return Wrapper(
C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
 508 val = getattr(self._gp, attr)
 509 if callable(val):
--> 510 return lambda *args: val(*gp_fixargs(args, True))
 511 else:
 512 return convertArcObjectToPythonObject(val)
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (Reclassify).
Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Jun 27, 2019 at 4:55
2
  • Yes I have set the workspace using arcpy.env.workspace but the error is till there Commented Jun 27, 2019 at 5:04
  • 2
    I have checked minimum and maximum values in arcgis also and its correct.Setting -9999 and 9999 as min and max didnt help. Same error Commented Jun 27, 2019 at 5:24

1 Answer 1

1

Cant' be sure of your input or other factors such as your environment extent or cellsize (i can only assume defaults). However the sample code below worked for me using your remap example. Possibly check your input data and your env settings.

You could also test another tool like Slice() just to verify your input is working.

from arcpy.sa import *
# create a sample input with enough values to reclassify based on users remap.
ras1 = CreateRandomRaster("",1, "0 0 1000 1000")
ras2 = ras1 * 1000
remap = RemapRange([[391, 677, 1],
 [677, 963, 2],
 [963, 1249, 3],
 [1249, 1535, 4],
 [1535, 1821, 5],
 [1821, 2107, 6],
 [2107, 2393, 7],
 [2393, 2679, 8],
 [2679, 2965, 9],
 [2965, 3242,10]])
dem_re = Reclassify(ras2,"VALUE",remap)
dem_re.save()
answered Jul 7, 2019 at 2:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.