예제 #1
0
파일: atten.py 프로젝트: tooowzh/wradlib
def correct_radome_attenuation_empirical(gateset,
                                         frequency=5.64,
                                         hydrophobicity=0.165,
                                         n_r=2,
                                         stat=np.mean):
    """Estimate two-way wet radome losses.

    Empirical function of frequency and rainfall rate for both standard and
    hydrophobic radomes based on the approach of :cite:`Merceret2000`.

    Parameters
    ----------
    gateset : :class:`numpy:numpy.ndarray`
        Multidimensional array, where the range gates (over which
        iteration has to be performed) are supposed to vary along the
        last array-dimension and the azimuths are supposed to vary
        along the next to last array-dimension. Data has to be provided
        in decibel representation of reflectivity [dBZ].
    frequency : float
        Radar-frequency [GHz]:

            Standard frequencies in X-band range between 8.0 and 12.0 GHz,

            Standard frequencies in C-band range between 4.0 and 8.0 GHz,

            Standard frequencies in S-band range between 2.0 and 4.0 GHz.

            Be aware that the empirical fit of the formula was just
            done for C- and S-band. The use for X-band is probably an
            undue extrapolation.

            Per default set to 5.64 as used by the German Weather
            Service radars.
    hydrophobicity : float
        Empirical parameter based on the hydrophobicity of the radome
        material.

            - 0.165 for standard radomes,
            - 0.0575 for hydrophobic radomes.

            Per default set to 0.165.
    n_r : int
        The radius of rangebins within the rain-intensity is
        statistically evaluated as the representative rain-intensity
        over radome.
    stat : object
        A name of a numpy function for statistical aggregation of the
        central rangebins defined by n_r.

        Potential options: np.mean, np.median, np.max, np.min.

    Returns
    -------
    k : :class:`numpy:numpy.ndarray`
        Array with the same shape as ``gateset`` containing the
        calculated two-way transmission loss [dB] for each range gate.
        In case the input array (gateset) contains NaNs the
        corresponding beams of the output array (k) will be set as NaN,
        too.
    """

    # Select rangebins inside the defined center-range n_r.
    center = gateset[..., :n_r].reshape(-1, n_r * gateset.shape[-2])
    center_m = np.ma.masked_array(center, np.isnan(center))
    # Calculate rainrate in the center-range based on statistical method stat
    # and with standard ZR-relation.
    rain_over_radome = zr.z_to_r(trafo.idecibel(stat(center_m, axis=-1)))
    # Estimate the empirical two-way transmission loss due to
    # radome-attenuation.
    k = 2 * hydrophobicity * rain_over_radome * np.tanh(frequency / 10.)**2
    # Reshape the result to gateset-shape.
    k = np.repeat(k,
                  gateset.shape[-1] * gateset.shape[-2]).reshape(gateset.shape)

    return k.filled(fill_value=np.nan)
예제 #2
0
 def test_z_to_r(self):
     assert zr.z_to_r(trafo.idecibel(10.0)) == 0.1537645610180688
예제 #3
0
 def test_z_to_r(self):
     self.assertEqual(zr.z_to_r(trafo.idecibel(10.)), 0.1537645610180688)
예제 #4
0
 def test_z_to_r(self):
     self.assertEqual(zr.z_to_r(trafo.idecibel(10.)), 0.1537645610180688)