Select to view content in your preferred language

arcpy not accepting irregular kernel files

2941
0
12-12-2013 07:07 AM
by Anonymous User
Not applicable
Original User: k_kent1

I'm trying to perform focal statistics on a raster using a custom kernel, but I keep getting an error when doing so through arcpy. I am using ArcGIS 10.1 SP1 for Desktop: Advanced (build 3143).

The kernel file and process works fine when I do it manually using the focal statistics tool in the spatial analyst toolbox. Also, I have tried using the modelbuilder to create a one step model that does the same and exporting it to a python script, and this also works fine.

However, when I try to write my own script following the examples listed here:
http://resources.arcgis.com/en/help/main/10.1/index.html#//005m00000061000000
and here:
http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000qs000000

I keep getting error code 010308: Invalid Irregular neighborhood mask.
This is leading me to believe there might be a bug, and not some sort of syntax error on my part, since the software has no problem with this kernel file when using the focal statistics tool in ArcMap.


I have attached my script and kernel file.

Also for reference, here is the text of script that is auto-generated by exporting the model doing the same process, which works just fine.

###this auto script works, the attached one does not
# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")

# Local variables:
small_alt_ras = "C:\\aa\\small_alt_ras"
model_out = "C:\\aa\\output\\model_out4"    

# Process: Focal Statistics
arcpy.gp.FocalStatistics_sa(small_alt_ras, model_out, "Irregular C:\\aa\\y_right_kernel.txt", "SUM", "DATA")
Tags (2)
0 Kudos
0 Replies