I need to retrieve minimum, maximum, mean, and standard deviation statistical values from a directory of raster files and store the values in an excel spreadsheet.
My approach as been cursors and GetRasterProperties_management.
Any insight would be greatly appreciated.
returns a result object, but what is your code that provides the shell around dealing with the result and putting it into a format that you can use for Table to Excel ?
That's a very good question. I was using a text document file with each object separated by a coma space.
actually I was referring to the code that cycles through the rasters and uses the tools's arcpy code access to get the stats. Or do you not have that bit yet? since you refer to cursors
for loop. but I really haven't gotten that bit to work properly yet.
i really feel like there is a more efficient approach I just have no idea what it could be. I also thought there would already be an existing tool for this objective but my searches have come up empty handed.
I did something similar the other day. Instead of keeping it all inside GIS, I did a standalone script and exported from the script to a .txt file, which I then imported in Excel.
The iterating and printing part of the script looks like this:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import arcpy, os, sys, string, glob
arcpy.env.overwriteOutput = True
shpWS = "E:\MidlGIS\I7010"
arcpy.env.workspace = shpWS
shplist = arcpy.ListFeatureClasses()
print (len(shplist))
for fc in shplist:
count = arcpy.GetCount_management(fc)
ord = fc
ord = ord[6:]
ord = ord[:-4]
print fc[1:5]+"____"+ ord +'____'+str(count)