sdsuper

suppressing results from being displayed

Discussion created by sdsuper on Oct 10, 2011
Latest reply on Oct 13, 2011 by sdsuper
Not sure if this would be best place to pose this question but I currently have a python script that runs 3 different tools on a folder of many files (>500). First I build an attribute table, then I calculate stats before extracting data from the data based on attributes. When it calculates the statistics for each file it outputs the result to the TOC and attempts to display them. I believe this is causing the program to crash whenever I call this script. Is there a way to keep these results from being added to the TOC?

After extracting the desired data I save the file to disk and this keeps the final output from being added to the TOC. Would this be the same case as all other results? I have I'd rather not save a bunch of intermediate files to disk that I don't need.

Here is the piece of code that performs the 3 tasks mentioned above:

-----------------------------------------------------------------
clause = "VALUE <> -9999 AND VALUE <> 0"
for infile in glob.iglob( os.path.join(source_path, 'M*.tif') ):
fn = os.path.splitext(os.path.basename(infile))[0]
arcpy.BuildRasterAttributeTable_management(infile, "Overwrite")
arcpy.CalculateStatistics_management(infile)
arcpy.CalculateStatistics_management.save
attExtract = ExtractByAttributes(infile,clause)
attExtract.save(target_path+fn+".tif")

Outcomes