def rankhist(X_f, X_o, X_min=None, normalize=True):
    """
    Compute a rank histogram counts and optionally normalize the histogram.

    Parameters
    ----------
    X_f: array-like
        Array of shape (k,m,n,...) containing the values from an ensemble
        forecast of k members with shape (m,n,...).
    X_o: array_like
        Array of shape (m,n,...) containing the observed values corresponding
        to the forecast.
    X_min: {float,None}
        Threshold for minimum intensity. Forecast-observation pairs, where all
        ensemble members and verifying observations are below X_min, are not
        counted in the rank histogram.
        If set to None, thresholding is not used.
    normalize: {bool, True}
        If True, normalize the rank histogram so that
        the bin counts sum to one.
    """

    X_f = X_f.copy()
    X_o = X_o.copy()
    num_ens_members = X_f.shape[0]
    rhist = rankhist_init(num_ens_members, X_min)
    rankhist_accum(rhist, X_f, X_o)
    return rankhist_compute(rhist, normalize)
Compute a rank histogram counts and optionally normalize the histogram.

Parameters
----------
X_f: array-like
Array of shape (k,m,n,...) containing the values from an ensemble
forecast of k members with shape (m,n,...).
X_o: array_like
Array of shape (m,n,...) containing the observed values corresponding
to the forecast.
X_min: {float,None}
Threshold for minimum intensity. Forecast-observation pairs, where all
ensemble members and verifying observations are below X_min, are not
counted in the rank histogram.
If set to None, thresholding is not used.
normalize: {bool, True}
If True, normalize the rank histogram so that
the bin counts sum to one.
pysteps/verification/ensscores.py