Hello everyone! I'm starting with Python and I hope someone will help me see through the mistakes I might have made.
I'm making a zona lstatistics as table loop with python and i would like to make ane average of all TIF files pixels according to a grid (.shp). When I run my script I've the error message bellow: ERROR 000876: Output raster: E:\climat_data\tb_51N_Precip_2014-01-15.dbf's extension is invalid for the output raster format.
Failed to execute (ZonalStatistics).
I'm leaving my script here... maybe someone can help me figure it out:
arcpy.CheckOutExtension("Spatial")
#Set local variables
in_zone_data = 'grid51N.shp'
zone_field = 'id'
raster = arcpy.ListRasters("51N*","ALL")
for stat in raster:
print (stat)
outDir = r"E:\climat_data"
for stat in raster:
raster_name = os.path.basename(stat).rstrip(os.path.splitext(stat)[1])
outTable = os.path.join(outDir,"tb_"+raster_name+".dbf")
arcpy.gp.ZonalStatistics_sa(in_zone_data, zone_field, stat, outTable, "MEAN", "NODATA")
print 'Done'+raster_name
Thank you for any help.