AnsweredAssumed Answered

Error 999999 on Train ISO Cluster Classifier

Question asked by JohnWallX on Jan 12, 2018
Latest reply on Jan 12, 2018 by HWei-esristaff

I am trying to run Train ISO Cluster Classifier using Python. Can someone help me identify why I am getting Error 999999?

 

My code looks like:

#Libraries
import arcpy, os
from arcpy import env
from arcpy.sa import *


inRaster = "C:/gis/oberlin/unsupervised/inrasternorm"
path = os.path.dirname(inRaster) #Get directory name
env.workspace = path #Set workspace
env.overwriteOutput = True

 

#Checkout extensions
arcpy.CheckOutExtension("Spatial")

 

#Build directory structure
segmentFolder = path + "/segments" #Stores the segmented images


try:
   os.stat(segmentFolder)
except:
   os.mkdir(segmentFolder)

   classifierFolder = path + "/classifier" #Stores the ECD classifier rules
try:
   os.stat(classifierFolder)
except:
   os.mkdir(classifierFolder)

   classifiedFolder = path + "/classified" #Stores the classified images
try:
   os.stat(classifiedFolder)
except:
   os.mkdir(classifiedFolder)

 

#Begin with the Segment Mean Shift variables that need to change
for x in range(5, 16, 1):   
   spectral_detail = x
   for y in range (5, 16, 1):
   spatial_detail = y
   min_segment_size = 100
   seg_raster = SegmentMeanShift(inRaster, spectral_detail, spatial_detail, min_segment_size)
   outName = segmentFolder + '/sms{:02d}_{:02d}.tif'.format(spectral_detail, spatial_detail)
   seg_raster.save(outName)

 

 

   TrainIsoClusterClassifier("C:/gis/oberlin/unsupervised/segments/sms05_06.tif", 5,    "C:/gis/oberlin/unsupervised/classifier/sms05_06.ecd", "C:/gis/oberlin/unsupervised/inrasternorm", 50, 100, "",    "MEAN")

 

   #Classify Raster
   classifiedraster = ClassifyRaster(seg_raster, out_definition, in_additional_raster)
   outName2 = classifiedFolder + '/clsfid{:02d}_{:02d}.tif'.format(spectral_detail, spatial_detail)
   classifiedraster.save(outName2)
print "Done!"

However, I get the following error:

Traceback (most recent call last):
File "C:\Python27\ArcGIS10.3\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\John\Desktop\unspervised_classifier.py", line 68, in <module>
TrainIsoClusterClassifier("C:/gis/oberlin/unsupervised/segments/sms05_06.tif", 5, "C:/gis/oberlin/unsupervised/classifier/sms05_06.ecd", "C:/gis/oberlin/unsupervised/inrasternorm", 50, 100, "", "MEAN")
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Functions.py", line 7741, in TrainIsoClusterClassifier
used_attributes)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Functions.py", line 7731, in Wrapper
used_attributes)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\geoprocessing\_base.py", line 504, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (TrainIsoClusterClassifier).

Outcomes