def calculate_ratios(correlations):
    """Calculate explained variance ratios from correlation.

    Parameters
    ----------
    Array of shape [component, scale_level, ...]
      containing correlation (skills) for each component (NWP and nowcast),
      scale level, and optionally along [y, x] dimensions.

    Returns
    -------
    out : numpy array
      An array containing the ratios of explain variance for each
      component, scale level, ...
    """
    # correlations: [component, scale, ...]
    square_corrs = np.square(correlations)
    # Calculate the ratio of the explained variance to the unexplained
    # variance of the nowcast and NWP model components
    out = square_corrs / (1 - square_corrs)
    # out: [component, scale, ...]
    return out
Calculate explained variance ratios from correlation.

Parameters
----------
Array of shape [component, scale_level, ...]
containing correlation (skills) for each component (NWP and nowcast),
scale level, and optionally along [y, x] dimensions.

Returns
-------
out : numpy array
An array containing the ratios of explain variance for each
component, scale level, ...
pysteps/blending/steps.py