<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic arcpy not accepting irregular kernel files in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/arcpy-not-accepting-irregular-kernel-files/m-p/172405#M608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: k_kent1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I try to write my own script following the examples listed here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005m00000061000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005m00000061000000&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000qs000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000qs000000&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I keep getting error code 010308: Invalid Irregular neighborhood mask.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attached my script and kernel file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;###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"&amp;nbsp;&amp;nbsp;&amp;nbsp; 

# Process: Focal Statistics
arcpy.gp.FocalStatistics_sa(small_alt_ras, model_out, "Irregular C:\\aa\\y_right_kernel.txt", "SUM", "DATA")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:55:23 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T08:55:23Z</dc:date>
    <item>
      <title>arcpy not accepting irregular kernel files</title>
      <link>https://community.esri.com/t5/transportation-questions/arcpy-not-accepting-irregular-kernel-files/m-p/172405#M608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: k_kent1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I try to write my own script following the examples listed here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005m00000061000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005m00000061000000&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000qs000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000qs000000&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I keep getting error code 010308: Invalid Irregular neighborhood mask.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attached my script and kernel file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;###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"&amp;nbsp;&amp;nbsp;&amp;nbsp; 

# Process: Focal Statistics
arcpy.gp.FocalStatistics_sa(small_alt_ras, model_out, "Irregular C:\\aa\\y_right_kernel.txt", "SUM", "DATA")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/arcpy-not-accepting-irregular-kernel-files/m-p/172405#M608</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T08:55:23Z</dc:date>
    </item>
  </channel>
</rss>

