def plotSatelliteGlobalMap(rx, sv, obstimes, color='r', lw=3, newfigure=False, center=[-130., 50], width=10000000, height=7000000): """ plotSAtelliteGlobalMap renders a global map with a satellite view projection, and put on the map a projection of a stallite trajectory in lat-lon format. There is option to put more satellites as a list of satellites. Size of the global map and the center of projection are optional parameters. Center is in the format [lon, lat], width and height are in meters. """ #Add optional marks on plot all_sky_location = [-147.43, 65.12] if newfigure: plt.figure() #Create a Basemap object: m = Basemap(width=width, height=height, projection='aeqd', resolution='c', lat_0=center[1], lon_0=center[0]) #Plot parallels and meridians parallels = [40, 50, 60, 70] m.drawparallels(parallels, labels=[False, True, True, True], linewidth=2) meridians = [-50, -90, -120, -150., -180., 150.] m.drawmeridians(meridians, labels=[True, True, False, True], linewidth=2) m.bluemarble() if isinstance(sv, int): sv_llt = pyGps.getSatellitePosition(rx, sv, obstimes, navfn, cs='wsg84') asi_x, asi_y = m(all_sky_location[0], all_sky_location[1]) sat_x, sat_y = m(sv_llt[1], sv_llt[0]) m.plot(sat_x, sat_y, color, linewidth=lw) m.scatter(asi_x, asi_y, marker='*', color='m', s=25) # plot a blue dot there else: asi_x, asi_y = m(all_sky_location[0], all_sky_location[1]) m.scatter(asi_x, asi_y, marker='*', color='m', s=25) # plot a blue dot there for sat in sv: sv_llt = pyGps.getSatellitePosition(rx, sat, obstimes, navfn, cs='wsg84') sat_x, sat_y = m(sv_llt[1], sv_llt[0]) m.plot(sat_x, sat_y, color, linewidth=lw) plt.show()
def tec(): aer = pyGps.getSatellitePosition(np.asarray(rx_xyz), sv, obstimes, navfname, cs='aer') L1 = np.array(data['L1', sv, :, 'data']) L2 = np.array(data['L2', sv, :, 'data']) P1 = np.array(data['C1', sv, :, 'data']) P2 = np.array(data['P2', sv, :, 'data']) #Phase corrected TEC sTECp = pyGps.getPhaseCorrTEC(L1, L2, P1, P2) vTECp = pyGps.getVerticalTEC(sTECp, aer[1], 130) tec_norm = vTECp #- vTECp[np.isfinite(vTECp[0:1000])].min() plotGps.plotTEC(obstimes, tec_norm, xlabel='UT', ylabel='vTEC [TECU]', ylim=[0, 17], ytick=[0, 5, 10, 14, 15, 16], color='--m', xlim=[ datetime.datetime(2015, 10, 7, 6, 10, 0), datetime.datetime(2015, 10, 7, 6, 40, 0) ])
def tec_keogram_intensity5(): N_roti = 100 aer = pyGps.getSatellitePosition(np.asarray(rx_xyz), sv, obstimes, navfname, cs='aer') L1 = np.array(data['L1', sv, :, 'data']) L2 = np.array(data['L2', sv, :, 'data']) P1 = np.array(data['C1', sv, :, 'data']) P2 = np.array(data['P2', sv, :, 'data']) l2_lli = np.array(data['L2', sv, :, 'lli']) #Phase corrected TEC sTECp = pyGps.getPhaseCorrTEC(L1, L2, P1, P2) vTECp = pyGps.getVerticalTEC(sTECp, aer[1], 130) tec_norm = vTECp - vTECp[np.isfinite(vTECp[0:1000])].min() # Rate of TEC Index roti = pyGps.getROTI(vTECp, N_roti) roti_t = obstimes[0:-N_roti] #ASI Intensity data # Piercing point for all-sky data aer = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='aer') #ipp = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='wsg84') #Asi intensity: t5, intensity5 = asi.getAllSkyIntensityAER(asi_folder3, aer[0], aer[1], ipp_alt, timelim, '558', obstimes=obstimes) t6, intensity6 = asi.getAllSkyIntensityAER(asi_folder3, aer[0], aer[1], ipp_alt, timelim, '630', obstimes=obstimes) t4, intensity4 = asi.getAllSkyIntensityAER(asi_folder3, aer[0], aer[1], ipp_alt, timelim, '428', obstimes=obstimes) # Asi Keogram ipp_aer = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='aer') t, el, i, el_out4 = asi.getASIKeogramIPP(asi_folder3, ipp_aer[0], ipp_alt, timelim, '558', obstimes=obstimes, elevation=aer[1]) # Magnetometer mag_folder = '/home/smrak/Documents/TheMahali/magnetometer/poker_2015_10_07.csv' mag = magnetometer.readMag(mag_folder, '2015-10-07') b_t = mag[0][5000:] mag_xyz = magnetometer.magHDZ2XYZ(mag, angle=True) plotting.plot5subplot(t, t5, obstimes, roti_t, i / 1E3, np.array(intensity5) / 1E3, tec_norm, roti, el1=el, ylabel1='Elevation [deg]', ylabel3='vTEC [TECU]', ylabel2='Intensity [kR]', ylabel4='ROTI[TECU/10s]', xlabel='UT', ylim1=[45, 85], color5='b', ytick1=[45, 55, 65, 75, 85], pcolorbar=True, cbartick=[0, 2, 4, 6, 8], cbartitle='Intensity [kR]', t31=t6, t32=t4, y31=np.array(intensity6) / 1E3, y32=np.array(intensity4) / 1E3, color2='g', color3='r', color4='b', legend1=True, label2='558nm', label3='630nm', label4='428nm', lli1=l2_lli, ylim2=[0, 3.5], ylim4=[0, 3.5], ylim3=[0, 18], ipp_elevation=aer[1], ytick2=[0, 1, 2, 3], ytick3=[0, 4, 8, 12, 16], ytick4=[0, 0.5, 1, 1.5, 2, 2.5, 3], Bt=b_t, Bx=mag_xyz[0][5000:] / 1000, ylabel5='Bx [uT]', cbx='b', ylim5=[12.2, 13], ytick5=[12.2, 12.4, 12.6, 12.8], xlim=[ datetime.datetime(2015, 10, 7, 6, 10, 0), datetime.datetime(2015, 10, 7, 6, 40, 0) ])
def tec_keogram_intensity3(): aer = pyGps.getSatellitePosition(np.asarray(rx_xyz), sv, obstimes, navfname, cs='aer') L1 = np.array(data['L1', sv, :, 'data']) L2 = np.array(data['L2', sv, :, 'data']) P1 = np.array(data['C1', sv, :, 'data']) P2 = np.array(data['P2', sv, :, 'data']) l2_lli = np.array(data['L2', sv, :, 'lli']) #Phase corrected TEC sTECp = pyGps.getPhaseCorrTEC(L1, L2, P1, P2) vTECp = pyGps.getVerticalTEC(sTECp, aer[1], 130) tec_norm = vTECp - vTECp[np.isfinite(vTECp[0:1000])].min() # Rate of TEC Index roti = pyGps.getROTI(vTECp, 10) roti_t = obstimes[0:-10] #ASI Intensity data # Piercing point for all-sky data aer = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='aer') ipp = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='wsg84') #Asi intensity: t5, intensity5 = asi.getAllSkyIntensityAER(asi_folder3, aer[0], aer[1], ipp_alt, timelim, '558', obstimes=obstimes) t5a, intensity5a = asi.getAllSkyIntensity(asi_folder3, ipp[0], ipp[1], ipp_alt, timelim, '558', obstimes=obstimes) # Asi Keogram ipp_aer = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, navfname, cs='aer') t, el, i, el_out4 = asi.getASIKeogramIPP(asi_folder3, ipp_aer[0], ipp_alt, timelim, '558', obstimes=obstimes, elevation=ipp[1]) plotting.plot4subplot(t, obstimes, t5, roti_t, i / 1E3, tec_norm, np.array(intensity5) / 1E3, roti, el1=el, ylabel1='Elevation [deg]', ylabel2='vTEC [TECU]', ylabel3='Intensity [kR]', ylabel4='ROTI[TECU/10s]', xlabel='UT', ylim1=[45, 85], color5='b', title1='Rx8 - PRN23, Poker Flat 10/07/2015', ytick1=[45, 55, 65, 75, 85], pcolorbar=True, cbartick=[0, 2, 4, 6, 8], cbartitle='Intensity [kR]', t31=t5a, y31=np.array(intensity5a) / 1E3, color2='g', color3='r', legend2=True, label2='org', label3='int', label4='630nm', lli1=l2_lli, ylim3=[0, 3.5], ylim4=[0, 3.5], ylim2=[0, 18], ipp_elevation=aer[1], ytick3=[0, 1, 2, 3], ytick2=[0, 4, 8, 12, 16], ytick4=[0, 0.5, 1, 1.5, 2, 2.5, 3], xlim=[ datetime.datetime(2015, 10, 7, 6, 10, 0), datetime.datetime(2015, 10, 7, 6, 40, 0) ])
def tec_vs_asi(): aer = pyGps.getSatellitePosition(np.asarray(rx_xyz), sv, obstimes, navfname, cs='aer') L1 = np.array(data['L1', sv, :, 'data']) L2 = np.array(data['L2', sv, :, 'data']) P1 = np.array(data['C1', sv, :, 'data']) P2 = np.array(data['P2', sv, :, 'data']) l2_lli = np.array(data['L2', sv, :, 'lli']) #Phase corrected TEC sTECp = pyGps.getPhaseCorrTEC(L1, L2, P1, P2) vTECp = pyGps.getVerticalTEC(sTECp, aer[1], 130) tec_norm = vTECp - vTECp[np.isfinite(vTECp[0:1000])].min() #ASI Intensity data # Piercing point for all-sky data # aer = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, ipp_alt, # navfname, cs='aer') ipp = pyGps.getIonosphericPiercingPoints(rx_xyz, sv, obstimes, 130E3, navfname, cs='wsg84') #Asi intensity: t5, intensity5 = asi.getAllSkyIntensity(asi_folder3, ipp[0], ipp[1], 130, timelim, '558', obstimes=obstimes) t4, intensity4 = asi.getAllSkyIntensity(asi_folder3, ipp[0], ipp[1], 130, timelim, '428', obstimes=obstimes) t6, intensity6 = asi.getAllSkyIntensity(asi_folder3, ipp[0], ipp[1], 130, timelim, '630', obstimes=obstimes) #Plot 2 subplots plotting.plot2subplot(obstimes, t5, tec_norm, (np.array(intensity5) / 1E3), ylabel1='vTEC [TECU]', ylabel2='Intensity [kR]', xlabel='UT', lli1=l2_lli, ylim2=[0.2, 2.6], lm='line', color2='g', lli2=l2_lli, t21=t4, y21=(np.array(intensity4) / 1E3), t22=t6, y22=(np.array(intensity6) / 1E3), label4='630nm', color4='r', color3='b', label2='558nm', label3='428nm', legend2=True, xlim=[ datetime.datetime(2015, 10, 7, 6, 10, 0), datetime.datetime(2015, 10, 7, 6, 40, 0) ])