# filters.mad¶

The **MAD filter** filter crops the input point cloud based on
the distribution of points in the specified dimension. Specifically, we choose
the method of median absolute deviation from the median (commonly referred to
as
MAD), which is robust to outliers (as opposed to mean and standard deviation).

Note

This method can remove real data, especially ridges and valleys in rugged terrain, or tall features such as towers and rooftops in flat terrain. While the number of deviations can be adjusted to account for such content-specific considerations, it must be used with care.

## Example¶

The sample pipeline below uses filters.mad to automatically crop the `Z`

dimension and remove possible outliers. The number of deviations from the
median has been adjusted to be less aggressive and to only crop those outliers
that are greater than four deviations from the median.

```
[
"input.las",
{
"type":"filters.mad",
"dimension":"Z",
"k":4.0
},
"output.laz"
]
```

## Options¶

- k
The number of deviations from the median. [Default: 2.0]

- dimension
The name of the dimension to filter.

- where
An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]

- where_merge
A strategy for merging points skipped by a ‘where’ option when running in standard mode. If

`true`

, the skipped points are added to the first point view returned by the skipped filter. If`false`

, skipped points are placed in their own point view. If`auto`

, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default:`auto`

]