Hello. I am using a Python script to run the SegmentMeanShift tool of Spatial Analyst, via arcpy:
arcpy.CheckOutExtension("Spatial")
seg_raster = SegmentMeanShift(in_raster, "20", "15", "10")
seg_raster.save(segments)
Running one instance of the tool works just fine. However, calling a new instance (on a different dataset) immediately fails.
Does anyone know how to successfully kick off multiple processes? It needs to be such that the script is called independently for each dataset (i.e., I can't know ahead of time how many datasets I will need to process; a second, or third, etc., process may be called at any time after the first one). Thanks.
Hmmm some questions
That's all for now
Dan Patterson:
Hmmm some questions
- where is in_raster defined?
- where is segments defined?
- what are you going to call the output file?
- is your environment location defined somewhere?
- What do you to call you output files?
- are you satisfied just to have a changing number appended to a base filename?
That's all for now
in_raster, seg_raster, and the output file (segements) are defined in the script before the three lines I provided. They are simple file locations on the local disk (e.g., D:\\path\\to\\dir\\raster.img)
Which environment settings are you referring to? I have experimented with setting arcpy.env.workspace and scratchWorkspace. I assume the scratch workspace should be different for each process?
The output files need to be named based on the input file, not an incrementing number.
Thanks!
Ok it would be best to provide code sample you are working with so that it can be incorporated within a for loop