AnsweredAssumed Answered

Cannot reclassify raster with python

Question asked by awa5114 on Aug 6, 2018
Latest reply on Aug 7, 2018 by Hornbydd

I have a raster which originates from a large tiff file being clipped and resampled. The resulting raster resampled_raster retains the same projection and opens up just fine in arcmap.


I would like to reclassify resampled_raster using arcpy and assign the result to a variable named reclassed_raster. Both resampled_raster and reclassed_raster are not string variables but rather variables of type <class 'arcpy.arcobjects.arcobjects.Result'> which should be fine for my purposes. I have been flinging these objects around in my script as geoprocessing inputs and outputs without any problems thus far.


The following command, when executed from cmd:


reclassed_raster =, "Value", "1 1;2 1;3 1;4 1;5 1;NODATA 0", "reclass", "DATA")


throws an error:


return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Error executing function.
General function failure This spatial reference object cannot be
defined from the available information. Failed to execute


Strangely, when I try to reclass my raster (the same exact one) through an arcmap session I don't have any problems, it reclasses just fine.


I also googled the error to see if any potential solutions or workarounds exist and I came across this link, which claims the following:


Cause This is expected behavior, as there are certain naming
restrictions set for the grid raster format. The naming restrictions
include special characters, which are not supported by the grid raster
format. Special characters may include accents and umlauts as well as
non-alphanumeric characters.


Solution or Workaround Rename the folder to ensure the path name of
the raster dataset does not contain special characters, or move the
raster file to a directory containing no special characters.


But in my case my directory contains no special characters. I tried different possibilities such as adding the name of the output raster in my function call, not assigning the result to a `reclassed_raster` variable and other obvious variations, but to no avail.


I need to be able to reclass this raster through cmd so I don't have to babysit my script. What could be the problem here? Why does it run OK in arcmap but not in my script through cmd?