def ROC_curve_accum(ROC, P_f, X_o):
    """Accumulate the given probability-observation pairs into the given ROC
    object.

    Parameters
    ----------
    ROC: dict
      A ROC curve object created with ROC_curve_init.
    P_f: array_like
      Forecasted probabilities for exceeding the threshold specified in the ROC
      object. Non-finite values are ignored.
    X_o: array_like
      Observed values. Non-finite values are ignored.
    """
    mask = np.logical_and(np.isfinite(P_f), np.isfinite(X_o))

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

    for i, p in enumerate(ROC["prob_thrs"]):
        mask = np.logical_and(P_f >= p, X_o >= ROC["X_min"])
        ROC["hits"][i] += np.sum(mask.astype(int))
        mask = np.logical_and(P_f < p, X_o >= ROC["X_min"])
        ROC["misses"][i] += np.sum(mask.astype(int))
        mask = np.logical_and(P_f >= p, X_o < ROC["X_min"])
        ROC["false_alarms"][i] += np.sum(mask.astype(int))
        mask = np.logical_and(P_f < p, X_o < ROC["X_min"])
        ROC["corr_neg"][i] += np.sum(mask.astype(int))
Accumulate the given probability-observation pairs into the given ROC
object.

Parameters
----------
ROC: dict
A ROC curve object created with ROC_curve_init.
P_f: array_like
Forecasted probabilities for exceeding the threshold specified in the ROC
object. Non-finite values are ignored.
X_o: array_like
Observed values. Non-finite values are ignored.
pysteps/verification/probscores.py