- metpy.calc.smooth_window(scalar_grid, window, passes=1, normalize_weights=True)¶
Filter with an arbitrary window smoother.
scalar_grid (array-like) – N-dimensional scalar grid to be smoothed
window (ndarray) – Window to use in smoothing. Can have dimension less than or equal to N. If dimension less than N, the scalar grid will be smoothed along its trailing dimensions. Shape along each dimension must be odd.
passes (int) – The number of times to apply the filter to the grid. Defaults to 1.
normalize_weights (bool) – If true, divide the values in window by the sum of all values in the window to obtain the normalized smoothing weights. If false, use supplied values directly as the weights.
array-like – The filtered scalar grid
This function can be applied multiple times to create a more smoothed field and will only smooth the interior points, leaving the end points with their original values (this function will leave an unsmoothed edge of size (n - 1) / 2 for each n in the shape of window around the data). If a masked value or NaN values exists in the array, it will propagate to any point that uses that particular grid point in the smoothing calculation. Applying the smoothing function multiple times will propagate NaNs further throughout the domain.