def _get_ranked_salience(precip_nowcast, precip_nwp):
    """Calculate ranked salience, which show how close the pixel is to the maximum intensity difference [r(x,y)=1]
      or the minimum intensity difference [r(x,y)=0]

    Parameters
    ----------
    precip_nowcast: array_like
      Array of shape (m,n) containing the extrapolated precipitation field at a specified timestep
    precip_nwp: array_like
      Array of shape (m,n) containing the NWP fields at a specified timestep

    Returns
    -------
    ranked_salience:
      Array of shape (m,n) containing ranked salience
    """

    # calcutate normalized intensity
    if np.max(precip_nowcast) == 0:
        norm_nowcast = np.zeros_like(precip_nowcast)
    else:
        norm_nowcast = precip_nowcast / np.max(precip_nowcast)

    if np.max(precip_nwp) == 0:
        norm_nwp = np.zeros_like(precip_nwp)
    else:
        norm_nwp = precip_nwp / np.max(precip_nwp)

    diff = norm_nowcast - norm_nwp

    # Calculate ranked salience, based on dense ranking method, in which equally comparable values receive the same ranking number
    ranked_salience = rankdata(diff, method="dense").reshape(diff.shape).astype("float")
    ranked_salience /= ranked_salience.max()

    return ranked_salience
Calculate ranked salience, which show how close the pixel is to the maximum intensity difference [r(x,y)=1]
or the minimum intensity difference [r(x,y)=0]

Parameters
----------
precip_nowcast: array_like
Array of shape (m,n) containing the extrapolated precipitation field at a specified timestep
precip_nwp: array_like
Array of shape (m,n) containing the NWP fields at a specified timestep

Returns
-------
ranked_salience:
Array of shape (m,n) containing ranked salience
pysteps/blending/linear_blending.py