def ensemble_skill(X_f, X_o, metric, **kwargs):
    """
    Compute mean ensemble skill for a given skill metric.

    Parameters
    ----------
    X_f: array-like
        Array of shape (l,m,n) containing the forecast fields of shape (m,n)
        from l ensemble members.
    X_o: array_like
        Array of shape (m,n) containing the observed field corresponding to
        the forecast.
    metric: str
        The deterministic skill metric to be used (list available in
        :func:`~pysteps.verification.interface.get_method`).

    Returns
    -------
    out: float
        The mean skill of all ensemble members that is used as defintion of
        ensemble skill (as in Zacharov and Rezcova 2009 with the FSS).

    References
    ----------
    :cite:`ZR2009`
    """

    if len(X_f.shape) != 3:
        raise ValueError(
            "the number of dimensions of X_f must be equal to 3, "
            + "but %i dimensions were passed" % len(X_f.shape)
        )
    if X_f.shape[1:] != X_o.shape:
        raise ValueError(
            "the shape of X_f does not match the shape of "
            + "X_o (%d,%d)!=(%d,%d)"
            % (X_f.shape[1], X_f.shape[2], X_o.shape[0], X_o.shape[1])
        )

    compute_skill = get_method(metric, type="deterministic")

    lolo = X_f.shape[0]
    skill = []
    for member in range(lolo):
        skill_ = compute_skill(X_f[member, :, :], X_o, **kwargs)
        if isinstance(skill_, dict):
            skill_ = skill_[metric]
        skill.append(skill_)

    return np.mean(skill)
Compute mean ensemble skill for a given skill metric.

Parameters
----------
X_f: array-like
Array of shape (l,m,n) containing the forecast fields of shape (m,n)
from l ensemble members.
X_o: array_like
Array of shape (m,n) containing the observed field corresponding to
the forecast.
metric: str
The deterministic skill metric to be used (list available in
:func:`~pysteps.verification.interface.get_method`).

Returns
-------
out: float
The mean skill of all ensemble members that is used as defintion of
ensemble skill (as in Zacharov and Rezcova 2009 with the FSS).

References
----------
:cite:`ZR2009`
pysteps/verification/ensscores.py