def _gaussianize(precip):
    """
    Gaussianize field using rank ordering as in :cite:`DOnofrio2014`.
    """
    m, n = np.shape(precip)
    nn = m * n
    ii = np.argsort(precip.reshape(nn))
    precip_gaussianize = np.zeros(nn)
    precip_gaussianize[ii] = sorted(np.random.normal(0, 1, nn))
    precip_gaussianize = precip_gaussianize.reshape(m, n)
    sd = np.std(precip_gaussianize)
    if sd == 0:
        sd = 1
    return precip_gaussianize / sd
Gaussianize field using rank ordering as in :cite:`DOnofrio2014`.
pysteps/downscaling/rainfarm.py