Summary Statistics Script

1598
2
04-01-2014 01:04 PM
SamanthaSmyth
New Contributor
Hi! I am attempting to write a script that will provide me with average NDVI pixel values in a raster, so I can later put the means into a time series. I keep getting an invalid syntax error in the "{case_field}" section of the code. This is an optional parameter that I do not think I want to utilize. Any input on what I am doing wrong would be very appreciated! Here is my script:

#Summary Statistics Tool.py
#Statistics_analysis(in_table, out_table, statistics_fields, {case_field})

#Import arcpy module
import arcpy
arcpy.env.workspace = r'D:\rmnp\SamSOrgNDVIData\TEST89\New folder'

#Local Variables
out_table= r'D:\rmnp\SamSOrgNDVIData\TEST89\New folders\\'

#Process: Summary Statistics
rastList=arcpy.ListRasters()
for rast in rastList:
    arcpy.Statistics_analysis(rast, out_table + "_St1", ["MEAN"], "#")
Tags (2)
0 Kudos
2 Replies
AnthonyGiles
Frequent Contributor
Samantha,

If the variable is optional and you don't want to use it just ignore it totally in your script

Regards

Anthony
0 Kudos
NeilAyres
MVP Alum
Errrr, doesn't Statistics_analysis work on tables or feature classes, not rasters.
Try GetRasterProperties_management, this will return the MEAN, STDEV, MIN, Max etc etc

Good luck,
Neil
0 Kudos