wrf.smooth2d¶
- wrf.smooth2d(field, passes, cenweight=2.0, meta=True)¶
Return the field smoothed.
The smoothing kernel applied is:
\[\begin{split}\frac{1}{4 + cenweight} * \begin{bmatrix} 0 & 1 & 0 \\ 1 & cenweight & 1 \\ 0 & 1 & 0 \end{bmatrix}\end{split}\]Data values along the borders are left unchanged. This routine does not modify the original data supplied by the field parameter..
If you need more general purpose multidimensional filtering tools, try the
scipy.ndimage.convolve()
method.- Parameters:
field (
xarray.DataArray
ornumpy.ndarray
) – The field to smooth, which must be at least two dimensions. Missing/fill values will be ignored as long as the type is either anumpy.ma.MaskedArray
or axarray.DataArray
with a _FillValue attribute.passes (
int
) – The number of smoothing passes.cenweight (
float
, optional) – The weight to apply to the center of the smoothing kernel. Default is 2.0.meta (
bool
) – Set to False to disable metadata and returnnumpy.ndarray
instead ofxarray.DataArray
. Default is True.
- Returns:
The smoothed field. If xarray is enabled and the meta parameter is True, then the result will be an
xarray.DataArray
object. Otherwise, the result will be either anumpy.ndarray
or anumpy.ma.MaskedArray
depending on the type for field.- Return type:
See also
scipy.ndimage.convolve()