Low Pass Filter Tool Operation

1480
1
06-11-2011 08:42 PM
JohnWhitman
New Contributor II
I'm having difficulty obtaining the expected result with the ArcGIS10 Spatial Analyst Low pass filter tool. Specifically, I have been unable to reproduce the results shown in Example 2 of the "Learn more about how the Filter Tool works" on the Help page.

I first created a point shapefile containing data matching Example 2 (including NoData values) and then used the Point to Raster tool to create from these points a 5 x 5 raster for experimentation.

The input array cell values are shown below.

Input Raster Values (Example 2 and My Raster)

2.000      3.000      4.000      5.000     6.000
2.000      3.000      4.000     NoData    6.000
2.000      3.000      4.000      5.000      6.000
2.000     30.000     4.000      5.000    NoData
1.000       2.000     2.000      3.000    NoData

I then ran the Low Pass Filter tool on that input raster, using both the "Ignore NoData" and "Don't Ignore NoData" switch options. Here are the results that I obtained.

My Results (with Ignore NoData Setting)

2.500      3.000      3.800      5.000      5.667
2.500      3.000      3.875      5.000      5.600
7.000      6.000      7.250      4.857      5.500
6.667      5.556      6.444      4.143      4.750
8.750      6.833      7.667      3.500      4.000

My Results (with Don't Ignore NoData Setting)

NoData NoData NoData NoData NoData
NoData 3.000 NoData NoData NoData
NoData 6.000 NoData NoData NoData
NoData 5.556 6.444 NoData NoData
NoData NoData NoData NoData NoData

Help Page Example 2 Output Values

2.333     3.000      3.889      5.000      5.778
2.333     3.000      3.889     NoData    5.778
5.333     6.000      6.889      4.889      5.778
5.000     5.556      6.444      4.333     NoData
4.667     5.111      5.889      3.111     NoData

No discrepancies exist between my results and Example 2 output values for those processing cells interior to the array and encountering no NoData values in their 3x3 neighborhood. Near the edges, however, and where NoData values are encountered the Help page explains that the processing algorithm operates as follows:

"When an input raster cell on the edge of the filter has a NoData value, the z-value of the cell is substituted for the missing z-values."

"On the edges of the raster, the filter lies partially outside the raster. When this occurs, the z-value of the cell at the center of the filter is substituted for the missing z-values."

I note that the 3x3 kernel of the LOW filter is equally weighted, with each weight = 1/9. Also, all cell values in the input array are integers. It should be expected, then, that multiplying the values of cells in the output array by 9 should produce integer values. This is indeed the case for the Example 2 output values (e.g., 5.778 x 9 = 52; 6.889 x 9 = 62, etc.)

This is NOT the case, however, for some of the values in my results -- the ones where the discrepancies noted above have been observed. For example, 3.875 x 9 = 34.875; 4.857 x 9 = 43.713, etc. I do not understand how this situation could occur.

The Tool Help for the Filter "Ignore NoData in calculations" switch describes its operation as follows:'

"Checked -- if a NoData value exists within the filter, the NoData value will ignored. Only cells within the filter that have data values will be used in determining the output."

"Unchecked: if a NoData value exists within the filter, the output for the processing cell with be NoData."

On the Help page, the Example 2 Output Values tabulated above don't explicitly state whether the "Ignore NoData in calculations" switch was checked or unchecked. By my reading it appears from the above quotes that it was checked since data values are produced in that example output for many of the cells for which a NoData cell was within the processing filter.

My reading of the two quotes above, however, doesn't lead me to understand why so many of my output cells in the "Don't Ignore NoData Setting" case, were set to NoData.

I'd very much appreciate help in understanding whether I have somehow misunderstood the processing algorithm for the low pass filter, most specifically the handling of NoData cells both in the interior of the input array and at its edges.

Additionally, since I find in my work that the uniform weighting of the 3x3 low pass filter kernel provided in Spatial Analyst is more restrictive than would be desirable, I'd appreciate any advice as whether and how I might be able to create a low pass filter with altered kernel cell values so as to accomplish weighted low pass filtering with either a 3x3 or 5x5 kernel.

Thanks in advance for your help!
0 Kudos
1 Reply
JuanLaguna
Esri Contributor
Hello John.

The source of the issue is that the documentation is actually not correct here.  Basically, when the Ignore NoData option is checked (the default), whenever a NoData cell is encountered in a neighbourhood window, it is indeed ignored and the calculation adjusted accordingly. When the Ignore option is unchecked, if a NoData cell is encountered in any cell of the neighbourhood window, the output cell will be NoData.


For example, lets consider the input cell in the third column, third row of the input:

nnnn    nnnnn    nnnnn    nnnnn    nnnn    nnnn
nnnn    3.000    4.000   NoData    nnnn    nnnn
nnnn    3.000    4.000    5.000    nnnnn    nnnnn
nnnn   30.00    4.000    5.000    nnnnn    nnnnn
nnnn    nnnnn    nnnnn    nnnn    nnnn    nnnnn
nnnn    nnnnn    nnnnn    nnnn    nnnn    nnnnn



For the Low option for Filter, and with the Ignore parameter enabled (checked), the value is calculated thusly:

  Output = sum of input cells / number of input cells.

So, in this example:
 
  Output = ((3.0 + 4.0) + (3.0 + 4.0 + 5.0) + (30.0 + 4.0 + 5.0)) / 8
       
    {Note that the divisor here is 8, instead of 9, since one of the input cells is NoData}

         = (7.0 + 12.0 + 39.0) / 8
         = (7.0 + 12.0 + 39.0) / 8
         = 58.0 / 8
         = 7.250
       
       
If the Ignore option had been unchecked (NoData), then the output for this cell would have been NoData.


The documentation for this tool been updated in the Web Help: How Filter works
   (note that it may take a day or two for the updates to show up)

Thank you for finding and reporting this problem!



Finally, to address your question about creating different kernels, you can use the Focal Statistics tool with the Irregular and Weight neighbourhood types.  With these you can define a custom kernel that should satisfy your requirements.


Juan Laguna
Spatial Analyst team
0 Kudos