Exemplo n.º 1
0
    def single_site_cloud_attenuation_synthesis(self, lat, lon, f,\
                                el, n, beta_1, beta_2, gamma_1, gamma_2, Ts=1):
        # Step A: 
        # SS_CL_1~4: Estimation of m, sigma and Pcwl
        m, sigma, Pcwl = lognormal_approximation_coefficient(lat, lon)
        Kl = specific_attenuation_coefficients(f, T=0)

        m = m.value + np.log(Kl / np.sin(np.deg2rad(el)))
        sigma = sigma.value
        Pc = Pcwl.value

        # Step C
        # SS_CL_6: Truncation threshold
        alpha = stats.norm.ppf(1 - Pc/100)

        # Step D: 
        # SS_CL_8~9: Filter the noise time series, with two recursive low-pass
        # filters
        rho_1 = np.exp(-beta_1 * Ts)
        rho_2 = np.exp(-beta_2 * Ts)

        X_1 = lfilter([np.sqrt(1 - rho_1**2)], [1, -rho_1], n, 0)
        X_2 = lfilter([np.sqrt(1 - rho_2**2)], [1, -rho_2], n, 0)

        # SS_CL_10: Compute Gc(kTs),
        G_c = gamma_1 * X_1 + gamma_2 * X_2
        # SS_CL_11: Compute Ac(kTs) (dB)
        arg1 = 100 * stats.norm.sf(G_c) / Pc
        arg2 = stats.norm.ppf(1 - arg1)

        Y_cloud = np.exp(m + sigma * arg2)
        A_cloud = np.where(G_c > alpha, Y_cloud, 0)

        return A_cloud.flatten()
Exemplo n.º 2
0
    def cloud_att_time_series(self):
        # Location of the receiver ground stations (Louvain-La-Neuve, Belgium)
        lat = 50.66
        lon = 4.62
        print('\nThe ITU-R P.1853 recommendation predict cloud attenuation time-series\n'+\
              'the following values for the Rx ground station coordinates (Louvain-La-Neuve, Belgium)')
        print('Lat = 50.66, Lon = 4.62')

        # Link parameters
        el = 30  # Elevation angle equal to 60 degrees
        f = 39.4 * u.GHz  # Frequency equal to 22.5 GHz
        tau = 45  # Polarization tilt
        D = 900 * 24 * 3600  #  duration (second) (900 days)
        Ts = 1  # Ts : sampling
        Ns = int(D / (Ts**2))  # number of samples

        print('Elevation angle:\t\t', el, '°')
        print('Frequency:\t\t\t', f)
        print('Polarization tilt:\t\t', tau, '°')
        print('Sampling Duration:\t\t', 900, 'days')

        #--------------------------------------------------------
        #  cloud attenuation time series synthesis by ITU-R P.1853
        #--------------------------------------------------------
        iturpropag.models.iturp1853.__version.change_version(1)
        L = cloud_liquid_water_synthesis(lat, lon, Ns, Ts=1).value
        Ac_timeseries = L * \
            specific_attenuation_coefficients(f, T=0) / np.sin(np.deg2rad(el))
        Ac_timeseries = Ac_timeseries.flatten()

        stat = iturpropag.utils.ccdf(Ac_timeseries, bins=300)
        #--------------------------------------------------------
        # cloud attenuation by ITU-R P.840
        #--------------------------------------------------------
        P = np.array([0.001, 0.002, 0.003, 0.005, 0.01, 0.02, 0.03, 0.05, 0.1,\
                       0.2, 0.3, 0.5, 1, 2, 3, 5, 10, 15, 20, 30, 40, 50,\
                        60, 70, 80, 90, 100])

        Ac = cloud_attenuation(lat, lon, el, f, P).value
        #--------------------------------------------------------
        # ploting the results
        #--------------------------------------------------------
        plt.figure()
        plt.plot(P, Ac, '-b', lw=2, label='ITU-R P.840')
        plt.plot(stat.get('ccdf'),
                 stat.get('bin_edges')[1:],
                 '-r',
                 lw=2,
                 label='ITU-R P.1853 (900 days)')
        plt.xlim((10**-3.5, 100))
        plt.xscale('log')
        plt.xlabel('Time percentage (%)')
        plt.ylabel('Cloud attenuation CCDF (dB)')
        plt.legend()
        plt.grid(which='both',
                 linestyle=':',
                 color='gray',
                 linewidth=0.3,
                 alpha=0.5)
        plt.tight_layout()
Exemplo n.º 3
0
    def cloud_attenuation_synthesis(self, lat, lon, f, el, Ns, Ts=1, n=None,
                                    **kwargs):
        """
        """

        L = cloud_liquid_water_synthesis(lat, lon, Ns, Ts=Ts, n=n).value

        Ac = L * \
            specific_attenuation_coefficients(f, T=0) / np.sin(np.deg2rad(el))
        
        return Ac.flatten()
Exemplo n.º 4
0
    def total_attenuation_synthesis(self,
                                    lat,
                                    lon,
                                    f,
                                    el,
                                    p,
                                    D,
                                    Ns,
                                    tau,
                                    eta,
                                    Ts=1,
                                    hs=None,
                                    rho=None,
                                    H=None,
                                    P=None,
                                    hL=1000,
                                    return_contributions=False):
        t_disc = int(5e6)
        # Step A Correlation coefficients:
        C_RC = 1
        C_CV = 0.8

        # Step B Scintillation polynomials
        def a_Fade(p):
            return -0.061 * np.log10(p)**3 + 0.072 * \
                np.log10(p)**2 - 1.71 * np.log10(p) + 3

        def a_Enhanc(p):
            return -0.0597 * np.log10(p)**3 - 0.0835 * \
                np.log10(p)**2 - 1.258 * np.log10(p) + 2.672

        # Step C1-C3:
        n_R = np.random.normal(0, 1, int((Ns * Ts + t_disc)))
        n_L0 = np.random.normal(0, 1, int((Ns * Ts + t_disc)))
        n_V0 = np.random.normal(0, 1, int((Ns * Ts + t_disc)))

        # Step C4-C5:
        n_L = C_RC * n_R + np.sqrt(1 - C_RC**2) * n_L0
        n_V = C_CV * n_L + np.sqrt(1 - C_CV**2) * n_V0

        # Step C6: Compute the rain attenuation time series
        if hs is None:
            hs = topographic_altitude(lat, lon)
        Ar = rain_attenuation_synthesis(lat,
                                        lon,
                                        f,
                                        el,
                                        tau,
                                        Ns,
                                        hs=hs,
                                        Ts=1,
                                        n=n_R).value
        Ar = Ar[t_disc:]

        # Step C7: Compute the cloud integrated liquid water content time
        # series
        L = cloud_liquid_water_synthesis(lat, lon, Ns, Ts=1, n=n_L).value
        L = L[t_disc:]
        Ac = L * \
            specific_attenuation_coefficients(f, T=0) / np.sin(np.deg2rad(el))
        Ac = Ac.flatten()

        # Step C9: Identify time stamps where A_R > 0 L > 1
        idx = np.where(np.logical_and(Ar > 0, L > 1))[0]
        idx_no = np.where(np.logical_not(np.logical_and(Ar > 0, L > 1)))[0]

        # Step C10: Discard the previous values of Ac and re-compute them by
        # linear interpolation vs. time starting from the non-discarded cloud
        # attenuations values
        Ac[idx] = np.interp(idx, idx_no, Ac[idx_no])

        # Step C11: Compute the integrated water vapour content time series
        V = integrated_water_vapour_synthesis(lat, lon, Ns, Ts=1, n=n_V).value
        V = V[t_disc:]

        # Step C12: Convert the integrated water vapour content time series
        # V into water vapour attenuation time series AV(kTs)
        Av = zenith_water_vapour_attenuation(lat, lon, p, f, V_t=V).value

        # Step C13: Compute the mean annual temperature Tm for the location of
        # interest using experimental values if available.
        Tm = surface_mean_temperature(lat, lon).value

        # Step C14: Convert the mean annual temperature Tm into mean annual
        # oxygen attenuation AO following the method recommended in
        # Recommendation ITU-R P.676.
        if P is None:
            P = standard_pressure(hs).value

        if rho is None:
            rho = standard_water_vapour_density(hs).value

        e = Tm * rho / 216.7
        go = gamma0_exact(f, P, rho, Tm).value
        ho, hw = slant_inclined_path_equivalent_height(f, P).value
        Ao = ho * go * np.ones_like(Ar)

        # Step C15: Synthesize unit variance scintillation time series
        sci_0 = scintillation_attenuation_synthesis(Ns, Ts=1).value

        # Step C16: Compute the correction coefficient time series Cx(kTs) in
        # order to distinguish between scintillation fades and enhancements:
        Q_sci = 100 * stats.norm.sf(sci_0)
        C_x = np.where(sci_0 > 0, a_Fade(Q_sci) / a_Enhanc(Q_sci), 1)

        # Step C17: Transform the integrated water vapour content time series
        # V(kTs) into the Gamma distributed time series Z(kTs) as follows:
        kappa, lambd = integrated_water_vapour_coefficients(lat, lon, None)
        Z = stats.gamma.ppf(np.exp(-(V / lambd)**kappa), 10, scale=0.1)

        # Step C18: Compute the scintillation standard deviation σ following
        # the method recommended in Recommendation ITU-R P.618.
        sigma = scintillation_attenuation_sigma(lat, lon, f, el, D, eta, Tm, H,
                                                P, hL).value

        # Step C19: Compute the scintillation time series sci:
        As = np.where(Ar > 1, sigma * sci_0 * C_x * Z * Ar**(5 / 12),
                      sigma * sci_0 * C_x * Z)

        # Step C20: Compute total tropospheric attenuation time series A(kTs)
        # as follows:
        A = Ar + Ac + Av + Ao + As

        if return_contributions:
            return (Ao + Av)[::Ts], Ac[::Ts], Ar[::Ts], As[::Ts], A[::Ts]
        else:
            return A[::Ts]
Exemplo n.º 5
0
    def total_attenuation_synthesis(self,
                                    lat,
                                    lon,
                                    f,
                                    el,
                                    p,
                                    D,
                                    Ns,
                                    tau,
                                    eta,
                                    Ts=1,
                                    hs=None,
                                    rho=None,
                                    H=None,
                                    P=None,
                                    hL=1000,
                                    return_contributions=False):
        t_disc = int(5e6)

        # Step MS_TOT_1:
        # Synthesize a white Gaussian noise time series page=18
        n = np.random.normal(0, 1, \
                        (np.size(lat), int(Ns * Ts + t_disc)))[::Ts]
        # Step MS_TOT_2:
        # Compute the annual mean oxygen gaseous attenuation
        Tm = surface_mean_temperature(lat, lon).value

        if P is None:
            P = surface_mean_pressure(lat, lon).value

        if rho is None:
            rho = surface_mean_water_vapour_density(lat, lon).value
        # Convert the mean annual temperature, pressure, water vapour to
        # oxygen attenuation AO following the method recommended in
        # Recommendation ITU-R P.676.
        e = Tm * rho / 216.7
        go = gamma0_exact(f, P, rho, Tm).value

        ho, hw = slant_inclined_path_equivalent_height(f, P).value

        Ao = np.atleast_2d(ho * go / np.sin(np.deg2rad(el))).T @ np.ones(
            (1, n.shape[-1]))
        Ao = Ao[:, np.ceil(t_disc / Ts).astype(int):]

        # Step MS_TOT_3:
        # calculate the water vapour attenuation time-series
        Awv = water_vapour_attenuation_synthesis(lat, lon, f, Ns, Ts=Ts,
                                                 n=n).value
        Awv = Awv[:, np.ceil(t_disc / Ts).astype(int):]

        # Step MS_TOT_4:
        # Calculate the cloud attenuation time-series
        Ac = cloud_attenuation_synthesis(lat, lon, f, el, Ns, Ts=1, n=n,\
                    rain_contribution=True).value
        Ac = Ac[:, np.ceil(t_disc / Ts).astype(int):]

        # Step MS_TOT_5:
        # Calculate the rain attenuation time series
        Ar = rain_attenuation_synthesis(lat,
                                        lon,
                                        f,
                                        el,
                                        tau,
                                        Ns,
                                        hs=hs,
                                        Ts=1,
                                        n=n).value
        Ar = Ar[:, np.ceil(t_disc / Ts).astype(int):]

        # Step MS_TOT_6:
        # limit the cloud attenuation time-series
        Ac_thresh = specific_attenuation_coefficients(f, T=0) / np.sin(
            np.deg2rad(el))
        Ac_thresh = np.atleast_2d(Ac_thresh).T @ np.ones((1, Ac.shape[-1]))
        Ac = np.where(np.logical_and(0 < Ar, Ac_thresh < Ac),\
                        Ac_thresh, Ac)

        # Step MS_TOT_7: Scintillation fading and enhancement polynomials
        def a_Fade(p):
            return -0.061 * np.log10(p)**3 + 0.072 * \
                np.log10(p)**2 - 1.71 * np.log10(p) + 3

        def a_Enhanc(p):
            return -0.0597 * np.log10(p)**3 - 0.0835 * \
                np.log10(p)**2 - 1.258 * np.log10(p) + 2.672

        # Step MS_TOT_8: Synthesize unit variance scintillation time series
        sci_0 = np.zeros_like(Awv)
        for ii, _ in enumerate(lat):
            sci_0[ii, :] = scintillation_attenuation_synthesis(Ns, Ts=Ts).value

        # Step MS_TOT_9: Compute the correction coefficient time series Cx(kTs) in
        # order to distinguish between scintillation fades and enhancements:
        Q_sci = 100 * stats.norm.sf(sci_0)
        C_x = np.where(sci_0 > 0, a_Fade(Q_sci) / a_Enhanc(Q_sci), 1)

        #Step MS_TOT_10:
        # limitation on Cx
        C_x = np.where(np.logical_or(C_x < 1, Q_sci > 45), 1, C_x)

        # Step MS_TOT_11: Compute the scintillation standard deviation σ following
        # the method recommended in Recommendation ITU-R P.618.
        sigma = np.atleast_1d(
                scintillation_attenuation_sigma(lat, lon, f, el, D, \
                                            eta, Tm, H, P, hL).value)

        # Step MS_TOT_12:
        # Transform the intermediate underlying Gaussian
        # process Gwv(kTs) into Gamma distribution time series Z(kTs) as follows:
        kappa, lambd = integrated_water_vapour_coefficients(lat, lon, f)

        Z = np.zeros_like(Awv)
        for ii, _ in enumerate(lat):
            Q_Gwv = np.exp(-(Awv[ii, :] / lambd[ii])**kappa[ii])
            Z[ii, :] = stats.gamma.ppf(1 - Q_Gwv, 10, scale=sigma[ii] / 10)

        # Step MS_TOT_13:
        # Compute the scintillation time series sci:
        As = np.where(Ar > 1, sci_0 * C_x * Z * Ar**(5 / 12), sci_0 * C_x * Z)

        # Step MS_TOT_14: Compute total tropospheric attenuation time series A(kTs)
        # as follows:
        A = Ar + Ac + Awv + Ao + As

        if return_contributions:
            return (Ao + Awv)[::Ts], Ac[::Ts], Ar[::Ts], As[::Ts], A[::Ts]
        else:
            return A[::Ts]