Filter (Spatial Analyst)
Summary
Performs either a smoothing (Low pass) or edge-enhancing (High pass) filter on a raster.
Usage
- 
The LOW filter option is an averaging (smoothing) filter. The HIGH filter option is an edge-enhancement filter. 
- 
Input NoData cells may receive a value in the output if the Ignore NoData in calculations option is checked, provided at least one cell within the filter neighborhood has a valid value. 
- You can use the Focal Statistics tool to create custom filters to your specification. 
Syntax
| Parameter | Explanation | Data Type | 
| in_raster | The input raster on which to perform the filter operation. | Raster Layer | 
| filter_type (Optional) | The type of filter operation to perform. 
 | String | 
| ignore_nodata (Optional) | Denotes whether NoData values are ignored by the filter calculation. 
 | Boolean | 
Return Value
| Name | Explanation | Data Type | 
| out_raster | The output filtered raster. | Raster | 
Code Sample
This example applies a high-pass filter to the input raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
filterOut =  Filter("elevation", "HIGH", "DATA") 
filterOut.save("C:/sapyexamples/output/filtered")
This example applies a low-pass filter to the input raster.
# Name: Filter_Ex_02.py
# Description: Performs a preset focal filter on a raster. 
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster = "elevation" 
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Filter
filterOut =  Filter(inRaster, "LOW", "") 
# Save the output 
filterOut.save("C:/sapyexamples/output/filterout")