def reldiag_accum(reldiag, P_f, X_o):
    """Accumulate the given probability-observation pairs into the reliability
    diagram.

    Parameters
    ----------
    reldiag: dict
      A reliability diagram object created with reldiag_init.
    P_f: array-like
      Forecast probabilities for exceeding the intensity threshold specified
      in the reliability diagram object.
    X_o: array-like
      Observed values.
    """
    mask = np.logical_and(np.isfinite(P_f), np.isfinite(X_o))

    P_f = P_f[mask]
    X_o = X_o[mask]

    idx = np.digitize(P_f, reldiag["bin_edges"], right=True)

    x = []
    y = []
    num_idx = []
    ss = []

    for k in range(1, len(reldiag["bin_edges"])):
        I_k = np.where(idx == k)[0]
        if len(I_k) >= reldiag["min_count"]:
            X_o_above_thr = (X_o[I_k] >= reldiag["X_min"]).astype(int)
            y.append(np.sum(X_o_above_thr))
            x.append(np.sum(P_f[I_k]))
            num_idx.append(len(I_k))
            ss.append(len(I_k))
        else:
            y.append(0.0)
            x.append(0.0)
            num_idx.append(0.0)
            ss.append(0)

    reldiag["X_sum"] += np.array(x)
    reldiag["Y_sum"] += np.array(y, dtype=int)
    reldiag["num_idx"] += np.array(num_idx, dtype=int)
    reldiag["sample_size"] += ss
Accumulate the given probability-observation pairs into the reliability
diagram.

Parameters
----------
reldiag: dict
A reliability diagram object created with reldiag_init.
P_f: array-like
Forecast probabilities for exceeding the intensity threshold specified
in the reliability diagram object.
X_o: array-like
Observed values.
pysteps/verification/probscores.py