Select to view content in your preferred language

Zonal statistics as table: "cannot set input into parameter..."

1247
3
03-08-2011 11:57 AM
RichardThurau
Deactivated User
Hi,
I'm trying to calculate statistics for multi-band raster based on an integer (zone) raster. I'm using the following code:

inZoneData = "P:/AOI_ras.img"
zoneField = "Value"
inValueRaster1 = "P:/bloom_mos1_stack1.img/Layer_1"
outTable1 = "P:/Stats/Lay1_stats"

arcpy.CheckOutExtension("Spatial")
# Execute ZonalStatistics as table
ZonalStatisticsAsTable(inZoneData, zoneField, inValueRaster1, outTable1, "ALL", "NODATA")

Seems simple enough, I've used this tool many times before in modelbuilder. Not today though. Python is returning the following error message:
"ExecuteError: ERROR 000622: Failed to execute (Zonal Statistics as Table). Parameters are not valid.
ERROR 000628: Cannot set input into parameter ignore_nodata."

I've messed around with setting the nodata parameter to "DATA", "NODATA", and left it blank (it is an optional parameter), but I get this same message everytime.

Anyone have any suggestions?

Thanks

Rich
Tags (2)
0 Kudos
3 Replies
ColinLindeman
Occasional Contributor
Hi Rich,

It looks like you have the ignore_nodata value "NODATA" and the statistics_type value "ALL" mixed up.

Here is a reference for this tools variables in version 10:
# Zonal Stats as table...ZonalStatisticsAsTable (in_zone_data, zone_field, in_value_raster, out_table, {ignore_nodata}, {statistics_type})

So try changing this...
ZonalStatisticsAsTable(inZoneData, zoneField, inValueRaster1, outTable1, "ALL", "NODATA")

to this:
ZonalStatisticsAsTable(inZoneData, zoneField, inValueRaster1, outTable1, "NODATA", "ALL")

Hope that helps!

-Colin Lindeman
0 Kudos
RichardThurau
Deactivated User
Colin, thanks. This syntax kills me sometimes.

RT
0 Kudos
RichardThurau
Deactivated User
All fixed. Thanks
0 Kudos