Example #1
0
def brier(fcsts, obs, fcst_percent, obs_percent):
    """
    A function to compute the Brier Score.
    
    Parameters
    ----------
    fcsts : numpy array               
        Array of the number of forecasts at a given forecast percent
    obs : numpy array
        Array of the number of observed grid points at a given 
        forecast threshold
    fcst_percent : numpy array
        An ordered array of the forecast probabilities.
    obs_percent : numpy array
        The ratio of observation points to forecast points at the
        corresponding forecast percent (fcst_percent)

    Returns
    -------
    brier_score : float
        The Brier Score
    """

    reliability = components.get_reliability(fcsts, fcst_percent, obs_percent)
    resolution = components.get_resolution(fcsts, obs, obs_percent)
    uncertainty = components.get_uncertainty(fcsts, obs)

    return reliability - resolution + uncertainty
Example #2
0
def brier_climo(fcsts, obs, fcst_percent, obs_percent):
    """
    A alternative function to compute the Brier Skill Score.

    Notes
    -----
    A special version of 'brier' used to compute the Brier Skill Score
    where the reference forecast is taken to be climatology

    Parameters
    ----------
    fcsts : numpy array               
        Array of the number of forecasts at a given forecast percent
    obs : numpy array
        Array of the number of observed grid points at a given 
        forecast threshold
    fcst_percent : numpy array
        An ordered array of the forecast probabilities.
    obs_percent : numpy array
        The ratio of observation points to forecast points at the
        corresponding forecast percent (fcst_percent)

    Returns
    -------
    brier__skill_score : float
        The Brier Skill Score
    """

    reliability = components.get_reliability(fcsts, fcst_percent, obs_percent)
    resolution = components.get_resolution(fcsts, obs, obs_percent)
    uncertainty = components.get_uncertainty(fcsts, obs)

    return (resolution - reliability) / uncertainty