def example04(): # Single longitudinal profile hwm14Obj = HWM14( alt=130., ap=[-1, 35], day=323, glonlim=[-180., 180.], glonstp=2., option=4, verbose=False, year=1993 ) hwm14Gbj = HWM14Plot( profObj=hwm14Obj )
def test_hwm14(): # Single Height profile h = HWM14(altlim=[90, 200], altstp=1, ap=[-1, 35], day=323, option=1, ut=11.66667, verbose=False, year=1993) assert_allclose([h.Uwind[92], h.Vwind[92]], [-16.502953, -39.811909])
def example01(): # Single Height profile hwm14Obj = HWM14(altlim=[90, 200], altstp=1, ap=[-1, 35], day=323, option=1, ut=11.66667, verbose=False, year=1993) # Height profile plot hwm14Gbj = HWM14Plot(profObj=hwm14Obj)
def example03(): # Single GMT profile hwm14Obj = HWM14(alt=130., ap=[-1, 35], day=323, option=3, utlim=[0., 23.45], utstp=.25, verbose=False, year=1993) # GMT profile plot hwm14Gbj = HWM14Plot(profObj=hwm14Obj)
def example02(): # Single latitudinal profile hwm14Obj = HWM14(alt=130., ap=[-1, 35], day=323, glatlim=[-90., 90.], glatstp=1., option=2, ut=11.66667, verbose=False, year=1993) # Latitudinal profile plot hwm14Gbj = HWM14Plot(profObj=hwm14Obj)
def getHWM(dt, lat, lon, elev): """ Gets the zonal and meridional winds at a specifc time and space dt - datetime obj lat, lon, elev - floats of position given in deg, deg, km """ if MODE == 93: winds = hwm93.run(dt, altkm=elev, glat=lat, glon=lon, f107a=150, f107=150, ap=4) u, v = winds.zonal.values[0], winds.meridional.values[0] else: dec_ut = dt.hour + dt.minute/60 + dt.second/3600 doy = dt.timetuple().tm_yday winds = HWM14(alt=elev, glat=lat, glon=lon, ut=dec_ut, \ year=dt.year, day=doy) print(winds) return u, v
def get_atmos(time, lat, lon, altitude=(0, 140, 1), apindex=35): """ Retrieve atmospheric conditions (temperature and wind) from MSISE-00 and HWM2014 models. """ alt_vector = np.arange(*altitude) Tn = msise00.run(time, altkm=alt_vector, glat=lat, glon=lon).Tn.data.ravel() wind = HWM14(altlim=[alt_vector[0], alt_vector[-1]], altstp=altitude[2], glat=lat, glon=lon, ap=[-1, apindex], ut=time.hour, day=time.julday, year=time.year, verbose=0) W_zonal, W_meridional = np.array([wind.Uwind, wind.Vwind]) return alt_vector, Tn, W_zonal, W_meridional
data_day=196 #15 of July data_lat=-0.180653 #latitude of Quito data_lon=-78.467834 #longitude of Quito data_zmin=0 data_zmax=200 data_N=1460 #number of profiles data_M=data_zmax-data_zmin+1 #number of points data_U=np.zeros((data_M,data_N)) #Contain the N profils each one has M points data_V=np.zeros((data_M,data_N)) #Contain the N profils each one has M points i_count=1 for i_day in np.arange(0,365,1): for i_hour in np.arange(0,18,6): hwm14Obj = HWM14( altlim=[data_zmin,data_zmax], altstp=1, ap=[-1, 35], glat=data_lat, glon=data_lon, day=i_day, option=1, ut=i_hour, verbose=False, year=data_year ) data_U[:,i_count]=hwm14Obj.Uwind data_V[:,i_count]=hwm14Obj.Vwind i_count+=1 # Compute the mean and substract from the data data_U_mean=data_U.mean(1) data_V_mean=data_V.mean(1) data_U=data_U-np.transpose(mtlb.repmat(data_U_mean,data_N,1)) data_V=data_V-np.transpose(mtlb.repmat(data_V_mean,data_N,1)) # Compute the svd U, s, V = np.linalg.svd(data_U, full_matrices=True) U2, s2, V2 = np.linalg.svd(data_V, full_matrices=True)