def compute_window_function(m, n, func, **kwargs):
    """
    Compute window function for a two-dimensional rectangular region. Window
    function-specific parameters are given as keyword arguments.

    Parameters
    ----------
    m: int
        Height of the array.
    n: int
        Width of the array.
    func: str
        The name of the window function.
        The currently implemented functions are
        'hann' and 'tukey'.

    Other Parameters
    ----------------
    alpha: float
        Applicable if func is 'tukey'.

    Notes
    -----
    Two-dimensional tapering weights are computed from one-dimensional window
    functions using w(r), where r is the distance from the center of the
    region.

    Returns
    -------
    out: array
        Array of shape (m, n) containing the tapering weights.
    """
    X, Y = np.meshgrid(np.arange(n), np.arange(m))
    R = np.sqrt(((X / n) - 0.5) ** 2 + ((Y / m) - 0.5) ** 2)

    if func == "hann":
        return _hann(R)
    elif func == "tukey":
        alpha = kwargs.get("alpha", 0.2)

        return _tukey(R, alpha)
    else:
        raise ValueError("invalid window function '%s'" % func)
Compute window function for a two-dimensional rectangular region. Window
function-specific parameters are given as keyword arguments.

Parameters
----------
m: int
Height of the array.
n: int
Width of the array.
func: str
The name of the window function.
The currently implemented functions are
'hann' and 'tukey'.

Other Parameters
----------------
alpha: float
Applicable if func is 'tukey'.

Notes
-----
Two-dimensional tapering weights are computed from one-dimensional window
functions using w(r), where r is the distance from the center of the
region.

Returns
-------
out: array
Array of shape (m, n) containing the tapering weights.
pysteps/utils/tapering.py