def _get_ws(weight, ranked_salience):
    """Calculate salience weight based on linear weight and ranked salience as described in :cite:`Hwang2015`.
      Cells with higher intensities result in larger weights.

    Parameters
    ----------
    weight: int
      Varying between 0 and 1
    ranked_salience: array_like
      Array of shape (m,n) containing ranked salience

    Returns
    -------
    ws: array_like
      Array of shape (m,n) containing salience weight, which preserves pixel intensties with time if they are strong
      enough based on the ranked salience.
    """

    # Calculate salience weighte
    ws = 0.5 * (
        (weight * ranked_salience)
        / (weight * ranked_salience + (1 - weight) * (1 - ranked_salience))
        + (
            np.sqrt(ranked_salience**2 + weight**2)
            / (
                np.sqrt(ranked_salience**2 + weight**2)
                + np.sqrt((1 - ranked_salience) ** 2 + (1 - weight) ** 2)
            )
        )
    )
    return ws
Calculate salience weight based on linear weight and ranked salience as described in :cite:`Hwang2015`.
Cells with higher intensities result in larger weights.

Parameters
----------
weight: int
Varying between 0 and 1
ranked_salience: array_like
Array of shape (m,n) containing ranked salience

Returns
-------
ws: array_like
Array of shape (m,n) containing salience weight, which preserves pixel intensties with time if they are strong
enough based on the ranked salience.
pysteps/blending/linear_blending.py