def test_map_africa(self): # Generate a regular grid of latitude and longitudes with 0.1 # degree resolution for the region of interest. lat, lon = iturpropag.utils.regular_lat_lon_grid(lat_max=60, lat_min=-60, lon_max=65, lon_min=-35, resolution_lon=1, resolution_lat=1) # Satellite coordinates (GEO, 4 E) lat_sat = 0 lon_sat = 4 h_sat = 35786 * u.km # Compute the elevation angle between satellite and ground stations el = iturpropag.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat, lon) # Set the link parameters f = 22.5 * u.GHz # Link frequency D = 1.2 * u.m # Antenna diameters p = 0.1 # Unavailability (Vals exceeded 0.1% of time) tau = 0 # polarization tilt angle eta = 0.5 # antenna efficiency # Compute the atmospheric attenuation Att = iturpropag.atmospheric_attenuation_slant_path( lat, lon, f, el, p, D, tau, eta) # Now we show the surface mean temperature distribution T = surface_mean_temperature(lat, lon)\ .to(u.Celsius, equivalencies=iturpropag.u.temperature()) # Plot the results try: m = iturpropag.utils.plot_in_map( Att.value, lat, lon, cbar_text='Atmospheric attenuation [dB]', cmap='magma', ax=plt.subplot(121)) # Plot the satellite location m.scatter(lon_sat, lat_sat, c='white', s=20) # plt.show() m = iturpropag.utils.plot_in_map( T.value, lat, lon, cbar_text='Surface mean temperature [C]', cmap='RdBu_r', ax=plt.subplot(122)) except RuntimeError as e: print(e)
def test_single_location_vs_p(self): # Ground station coordinates (Boston) lat_GS = 42.3601 lon_GS = -71.0942 # Satellite coordinates (GEO, 77 W) lat_sat = 0 lon_sat = -77 h_sat = 35786 * u.km # Compute the elevation angle between satellite and ground station el = iturpropag.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat_GS, lon_GS) f = 22.5 * u.GHz # Link frequency D = 1.2 * u.m # Antenna diameters tau = 0 # polarization tilt angle eta = 0.5 # antenna efficiency # Define unavailabilities vector in logarithmic scale # p = np.logspace(-1.5, 1.5, 100) p = np.logspace(0.05, 0.695, 100) A_g, A_c, A_r, A_s, A_t = \ iturpropag.atmospheric_attenuation_slant_path( lat_GS, lon_GS, f, el, p, D, tau, eta, return_contributions=True) # Plot the results using matplotlib f, ax = plt.subplots(1, 1) ax.semilogx(p, A_g.value, label='Gaseous attenuation') ax.semilogx(p, A_c.value, label='Cloud attenuation') ax.semilogx(p, A_r.value, label='Rain attenuation') ax.semilogx(p, A_s.value, label='Scintillation attenuation') ax.semilogx(p, A_t.value, label='Total atmospheric attenuation') ax.set_xlabel('Percentage of time attenuation value is exceeded [%]') ax.set_ylabel('Attenuation [dB]') ax.grid(which='both', linestyle=':') plt.legend()
def test_single_location(self): # Location of the receiver ground stations (Boston, MA) lat = 42.31 lon = -70.91 print( '\nThe ITU recommendations predict the following values\nfor the Rx ground station coordinates (Boston, MA)' ) print('Lat = 42.31, Lon = -70.91') # Link parameters el = 60 # Elevation angle equal to 60 degrees f = 22.5 * u.GHz # Frequency equal to 22.5 GHz D = 1 * u.m # Receiver antenna diameter of 1 m p = 0.1 # We compute values exceeded during 0.1 % of # the average year eta = 0.6 # Antenna efficiency tau = 45 # Polarization tilt print('Elevation angle:\t\t', el, '°') print('Frequency:\t\t\t', f) print('Rx antenna diameter:\t\t', D) print('Values exceeded during 0.1 percent of the year') print('Antenna efficiency:\t\t', eta) print('Polarization tilt:\t\t', tau, '°') # Compute atmospheric parameters hs = topographic_altitude(lat, lon) print('Topographic altitude [ITU-R P.1511]:\t', hs) T = surface_mean_temperature(lat, lon) print('Surface mean temperature [ITU-R P.1510]:\t', T, '=', T.value - 273.15, '°C') P = pressure(lat, hs) print('Surface pressure [ITU-R P.835]:\t', P) T_sa = temperature(lat, hs) print('Standard surface temperature [ITU-R P.835]:\t', T_sa, '=', T_sa.value - 273.15, '°C') rho_sa = water_vapour_density(lat, hs) print('Standard water vapour density [ITU-R P.835]:\t', rho_sa) rho_p = surface_water_vapour_density(lat, lon, p, hs) print('Surface water vapour density (p=0.1%) [ITU-R P.836]:\t', rho_p) V = total_water_vapour_content(lat, lon, p, hs) print('Total water vapour content (p=0.1%) [ITU-R P.836]:\t', V) # Compute rain and cloud-related parameters R_prob = rain_attenuation_probability(lat, lon, el, hs) print('Rain attenuation probability [ITU-R P.618]:\t', R_prob) R_pct_prob = rainfall_probability(lat, lon) print('Rainfall probability [ITU-R P.837]:\t', R_pct_prob) R001 = rainfall_rate(lat, lon, p) print('Rainfall rate exceeded for p=0.1% [ITU-R P.836]:\tt', R001) h_0 = isotherm_0(lat, lon) print('0°C Isotherm height [ITU-R P.839]:\t', h_0) h_rain = rain_height(lat, lon) print('Rain height [ITU-R P.839]:\t', h_rain) L_red = columnar_content_reduced_liquid(lat, lon, p) print('Reduced liquid columnar content (p=0.1%) [P.836]:\t', L_red) A_w = zenith_water_vapour_attenuation(lat, lon, p, f, h=hs) print('Zenith water vapour attenuation: [ITU-R P.676]:\t', A_w) # Compute attenuation values A_g = gaseous_attenuation_slant_path(f, el, rho_p, P, T) print('Gaseous attenuation slant path [ITU-R P.676]:\t', A_g) A_r = rain_attenuation(lat, lon, f, el, p, tau, hs=hs) print('Rain attenuation [ITU-R P.618]:\t', A_r) A_c = cloud_attenuation(lat, lon, el, f, p) print('Cloud attenuation [ITU-R P.840]:\t', A_c) A_s = scintillation_attenuation(lat, lon, f, el, p, D, eta) print('Scintillation attenuation [ITU-R P.618]:\t', A_s) A_t = iturpropag.atmospheric_attenuation_slant_path( lat, lon, f, el, p, D, tau, eta) print('Atmospheric attenuation slant path [ITU-R P.618]:\t', A_t)
def test_single_location_vs_f(self): # Ground station coordinates (Boston) lat_GS = 42.3601 lon_GS = -71.0942 ################################################ # First case: Attenuation vs. frequency # ################################################ # Satellite coordinates (GEO, 77 W) lat_sat = 0 lon_sat = -77 h_sat = 35786 * u.km # Compute the elevation angle between satellite and ground station el = iturpropag.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat_GS, lon_GS) f = 22.5 * u.GHz # Link frequency D = 1.2 * u.m # Antenna diameters p = 1 tau = 0 # polarization tilt angle eta = 0.5 # antenna efficiency f = np.logspace(-0.2, 2, 100) * u.GHz Ag, Ac, Ar, As, A =\ iturpropag.atmospheric_attenuation_slant_path(lat_GS, lon_GS, f, el, p, D, tau, eta, return_contributions=True) # Plot the results fig, ax = plt.subplots(1, 1) ax.loglog(f, Ag, label='Gaseous attenuation') ax.loglog(f, Ac, label='Cloud attenuation') ax.loglog(f, Ar, label='Rain attenuation') ax.loglog(f, As, label='Scintillation attenuation') ax.loglog(f, A, label='Total atmospheric attenuation') ax.set_xlabel('Frequency [GHz]') ax.set_ylabel('Atmospheric attenuation [dB]') ax.grid(which='both', linestyle=':') plt.legend(loc='upper left') ################################################ # Second case: Attenuation vs. elevation angle # ################################################ f = 22.5 * u.GHz el = np.linspace(5, 90, 100) Ag, Ac, Ar, As, A =\ iturpropag.atmospheric_attenuation_slant_path(lat_GS, lon_GS, f, el, p, D, tau, eta, return_contributions=True) # Plot the results fig, ax = plt.subplots(1, 1) ax.plot(el, Ag, label='Gaseous attenuation') ax.plot(el, Ac, label='Cloud attenuation') ax.plot(el, Ar, label='Rain attenuation') ax.plot(el, As, label='Scintillation attenuation') ax.plot(el, A, label='Total atmospheric attenuation') ax.set_xlabel('Elevation angle [deg]') ax.set_ylabel('Atmospheric attenuation [dB]') ax.grid(which='both', linestyle=':') plt.legend()
def test_multiple_locations(self): # Obtain the coordinates of the different cities # cities = {'Boston': (42.36, -71.06), # 'New York': (40.71, -74.01), # 'Los Angeles': (34.05, -118.24), # 'Denver': (39.74, -104.99), # 'Las Vegas': (36.20, -115.14), # 'Seattle': (47.61, -122.33), # 'Washington DC': (38.91, -77.04)} cities = { #'Geneva': (46.20, 6.15), 'New York': (40.71, -74.01), 'Nairobi': (-1.28, 36.82), 'Beijing': (39.93, 116.38), 'Moskwa': (55.75, 37.62), 'Buenos Aires': (-34.60, -58.38), 'Sidney': (-33.85, 151.20), 'Cherrapunji': (25.30, 91.70) } lat = [coords[0] for coords in cities.values()] lon = [coords[1] for coords in cities.values()] # Satellite coordinates (GEO, 4 E) lat_sat = 0 lon_sat = -77 h_sat = 35786 * u.km # Compute the elevation angle between satellite and ground stations el = iturpropag.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat, lon) # Set the link parameters f = 22.5 * u.GHz # Link frequency D = 1.2 * u.m # Antenna diameters p = 0.1 # Unavailability (Vals exceeded 0.1% of time) tau = 0 # polarization tilt angle eta = 0.5 # antenna efficiency # Compute the atmospheric attenuation Ag, Ac, Ar, As, Att = iturpropag.atmospheric_attenuation_slant_path( lat, lon, f, el, p, D, tau, eta, return_contributions=True) # Plot the results city_idx = np.arange(len(cities)) width = 0.15 fig, ax = plt.subplots(1, 1) ax.bar(city_idx, Att.value, width=0.6, label='Total atmospheric Attenuation') ax.bar(city_idx - 1.5 * width, Ar.value, width=width, label='Rain attenuation') ax.bar(city_idx - 0.5 * width, Ag.value, width=width, label='Gaseous attenuation') ax.bar(city_idx + 0.5 * width, Ac.value, width=width, label='Clouds attenuation') ax.bar(city_idx + 1.5 * width, As.value, width=width, label='Scintillation attenuation') # Set the labels ticks = ax.set_xticklabels([''] + list(cities.keys())) for t in ticks: t.set_rotation(45) ax.set_ylabel('Atmospheric attenuation exceeded for 0.1% [dB]') # Format image ax.yaxis.grid(which='both', linestyle=':') ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.3), ncol=2) plt.tight_layout(rect=(0, 0, 1, 0.85))