def compute_mask_window_function(mask, func, **kwargs):
    """
    Compute window function for a two-dimensional area defined by a
    non-rectangular mask. The window function is computed based on the distance
    to the nearest boundary point of the mask. Window function-specific
    parameters are given as keyword arguments.

    Parameters
    ----------
    mask: array_like
        Two-dimensional boolean array containing the mask.
        Pixels with True/False are inside/outside the mask.
    func: str
        The name of the window function. The currently implemented function is
        'tukey'.

    Returns
    -------
    out: array
        Array containing the tapering weights.
    """
    R = _compute_mask_distances(mask)

    if func == "hann":
        raise NotImplementedError("Hann function has not been implemented")
    elif func == "tukey":
        r_max = kwargs.get("r_max", 10.0)

        return _tukey_masked(R, r_max, np.isfinite(R))
    else:
        raise ValueError("invalid window function '%s'" % func)
Compute window function for a two-dimensional area defined by a
non-rectangular mask. The window function is computed based on the distance
to the nearest boundary point of the mask. Window function-specific
parameters are given as keyword arguments.

Parameters
----------
mask: array_like
Two-dimensional boolean array containing the mask.
Pixels with True/False are inside/outside the mask.
func: str
The name of the window function. The currently implemented function is
'tukey'.

Returns
-------
out: array
Array containing the tapering weights.
pysteps/utils/tapering.py