smooth_n_point

smooth_n_point(fs, n=9, repeat=1, **kwargs)

New in metview-python version 1.13.0.

Performs spatial smoothing using a 5 or 9 point technique for each field in fs.

Parameters
  • fs (Fieldset) – input fieldset

  • n (number) – specifies the type of smoothing (n=5 or n=9)

  • repeat (number) – specifies how many times the smoothing should be applied to fs

  • **kwargs

    these arguments are directly passed to scipy.ndimage.convolve() (see below)

Return type

Fieldset

The computations are performed as a 2D convolution by calling scipy.ndimage.convolve() and the extra **kwargs are directly passed to this function. The convolution matrices (weights in the scipy.ndimage.convolve() terminology) are defined as follows:

  • with n=5:

    \[\begin{split}\frac{1}{8} \begin{bmatrix}0 & 1 & 0\\1 & 4 & 1\\0 & 1 &0\end{bmatrix}\end{split}\]
  • with n=9:

    \[\begin{split}\frac{1}{16} \begin{bmatrix}1 & 2 & 1\\2 & 4 & 2\\1 & 2 &1\end{bmatrix}\end{split}\]

Warning

smooth_n_points() has some limitations:

  • it only works for regular latitude-longitude grids

  • for global grids in longitudinal (East-West) direction the resulting field is not smoothed properly along the periodic border