def binary_mse(X_f, X_o, thr, wavelet="haar", return_scales=True):
    """
    Compute the MSE of the binary error as a function of spatial scale.

    This method uses PyWavelets for decomposing the error field between the
    forecasts and observations into multiple spatial scales.

    Parameters
    ----------
    X_f: array_like
        Array of shape (m, n) containing the forecast field.
    X_o: array_like
        Array of shape (m, n) containing the verification observation field.
    thr: sequence
        The intensity threshold for which to compute the verification.
    wavelet: str, optional
        The name of the wavelet function to use. Defaults to the Haar wavelet,
        as described in Casati et al. 2004. See the documentation of PyWavelets
        for a list of available options.
    return_scales: bool, optional
        Whether to return the spatial scales resulting from the wavelet
        decomposition.

    Returns
    -------
    SS: array
        One-dimensional array containing the binary MSE for each spatial scale.
    scales: list, optional
        If ``return_scales=True``, return the spatial scales in pixels resulting
        from the wavelet decomposition.

    References
    ----------
    :cite:`CRS2004`
    """

    bmse = binary_mse_init(thr, wavelet)
    binary_mse_accum(bmse, X_f, X_o)
    return binary_mse_compute(bmse, return_scales)
Compute the MSE of the binary error as a function of spatial scale.

This method uses PyWavelets for decomposing the error field between the
forecasts and observations into multiple spatial scales.

Parameters
----------
X_f: array_like
Array of shape (m, n) containing the forecast field.
X_o: array_like
Array of shape (m, n) containing the verification observation field.
thr: sequence
The intensity threshold for which to compute the verification.
wavelet: str, optional
The name of the wavelet function to use. Defaults to the Haar wavelet,
as described in Casati et al. 2004. See the documentation of PyWavelets
for a list of available options.
return_scales: bool, optional
Whether to return the spatial scales resulting from the wavelet
decomposition.

Returns
-------
SS: array
One-dimensional array containing the binary MSE for each spatial scale.
scales: list, optional
If ``return_scales=True``, return the spatial scales in pixels resulting
from the wavelet decomposition.

References
----------
:cite:`CRS2004`
pysteps/verification/spatialscores.py