0

I am new to Python and trying to determine what is wrong with the following code:

-- error message --

arcgisscripting.ExecuteError: ERROR 999999: Error executing function. The table was not found. [VAT_Recl_slope] No spatial reference exists. Failed to execute (Reclassify).

-- code --

import arcpy
from arcpy.sa import *
arcpy.gp.overwriteOutput = True
arcpy.env.workspace = my_workspace

arcpy.env.extent = "D:\\01_PhD_work_Alex\\ArcGIS\\01_Raw_data\\NZ_outline.shp"
arcpy.env.cellSize = "fault_dist_cp"

raster_list = arcpy.ListRasters("*", "*")
for raster in raster_list:
    print raster

arcpy.CheckOutExtension("3D")

slope = "slope_2K"
distance_fault = "fault_di"
ditance_river = "river_di"
MMI = "kaik_grid_2K"
Recl_SPI = "spi_rcls2"

Recl_slope = arcpy.gp.Reclassify_sa(slope, "Value", "-100 5 1;5 10 2;10 15 3;15 20 4;20 25 5;25 30 6;30 35 7;35 40 8;40 45 9;45 50 10;50 100 11", "Recl_slope", "DATA")

Recl_fault = arcpy.gp.Reclassify_sa(distance_fault, "Value", "-100 5000 1;5000 10000 2;10000 20000 3;20000 30000 4;30000 40000 5;40000 50000 6; 50000 130000 7", "Recl_fault", "DATA")

Recl_river = arcpy.gp.Reclassify_sa(distance_river, "Value", "-100 500 1;500 1000 2;1000 1500 3;1500 2000 4;2000 2500 5;2500 70000 6", "Recl_river", "DATA")

Recl_MMI = arcpy.gp.Reclassify_sa(MMI, "Value", "-100 4 1; 4 5 2; 5 6 3;6 7 4;7 8 5;8 11 6", "Recl_MMI", "DATA")

1 Answer 1

1

It's failing on the first Reclassify function - this is a general error that can point to a lot of causes, but the fact that it's telling you it cannot find the table and spatial reference doesn't exist probably means that the "slope_2k" layer lacks a proper spatial reference. Check the Source tab in the Properties for this layer, and see if there is a coordinate system listed. If not, that's your problem.

If the slope_2k layer looks fine, the most effective approach is probably closing out ArcMap entirely, re-opening, and then in a blank canvas load just the Slope_2k raster. Then in the Python window, enter just the two lines:

slope = "slope_2K"
arcpy.gp.Reclassify_sa(slope, "Value", "-100 5 1;5 10 2;10 15 3;15 20 4;20 25 5;25 30 6;30 35 7;35 40 8;40 45 9;45 50 10;50 100 11", "Recl_slope", "DATA")

If that works, then the issue is resolved, and you can load in the rest and re-run the script.

2
  • 1
    I checked the data: Spatial data & coordinate system is OK. I tried with the data outside a geodatabase and it is working ...Thank you for the help
    – alex dun
    Oct 31, 2017 at 1:10
  • No problem - glad it's working.
    – AlecZ
    Oct 31, 2017 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.