コード例 #1
0
def Main_Fun(rundate, gamma, flux_s):
     
    
     #output times
     if rundate == "Nov302013":     
          dump_time_list, Times = Make_Timelists(1, 900, 28800)
          Times = np.array(Times)
     else:
          dump_time_list, Times = Make_Timelists(1, 600, 28800)
          Times = np.array(Times)
     

     #class for pulling data files
     files = For_Plots(rundate)

     #Create lists of variable lists
     #TODO: need to test Deltatheta
     first_theta_file = files.get_file(dump_time_list[0], "theta_bar")
     theta_file_list = [files.get_file(dump_time, "theta_bar") for dump_time in dump_time_list]
     press_file_list = [files.get_file(dump_time, "press") for dump_time in dump_time_list]
     flux_file_list = [files.get_file(dump_time, "wvelthetapert") for dump_time in dump_time_list]
     height_file = files.get_file("0000000600", "heights")

     AvProfLims = []
     invrinos = []
     #loop over text files files
     for i in range(len(theta_file_list)):
         print i, theta_file_list[i]
         theta0=np.genfromtxt(first_theta_file)
         theta = np.genfromtxt(theta_file_list[i])
         print theta.shape
         height = np.genfromtxt(height_file)
    
         press = np.genfromtxt(press_file_list[i])
         rhow = nc.calc_rhow(press, height, theta[0])
         wvelthetapert = np.genfromtxt(flux_file_list[i])
         
         #only need up to 1900meters
         if rundate == "Jan152014_1":
             top_index = np.where(abs(2000 - height) < 26.)[0][0] #may need to be higher (e.g. for 60/2.5)
         else:
             top_index = np.where(abs(1700 - height) < 26.)[0][0] #may need to be higher (e.g. for 60/2.5)
           
         print height.shape, press.shape, theta.shape, wvelthetapert.shape, gamma, top_index

         #function for calcuating heights
         [elbot_dthetadz, h, eltop_dthetadz, elbot_flux ,h_flux  ,eltop_flux, deltatheta, Deltatheta, mltheta]= nc.Get_CBLHeights(height, press, theta, theta0, wvelthetapert, gamma, flux_s, top_index)

         print elbot_dthetadz, h, eltop_dthetadz, elbot_flux ,h_flux  ,eltop_flux, deltatheta, mltheta
         
         delta_h=eltop_dthetadz - elbot_dthetadz
         
         [rino, invrino, wstar, S, pi3, pi4] =  nc.calc_rino(h, mltheta, 1.0*flux_s/(rhow[0]*1004), deltatheta, gamma, delta_h)

         AvProfLims.append([elbot_dthetadz, h, eltop_dthetadz, elbot_flux, h_flux, eltop_flux, deltatheta, Deltatheta, mltheta])
         tau = 1.0*h/wstar
         invrinos.append([rino, invrino, wstar, S, tau, mltheta, deltatheta, pi3, pi4])

     files.save_file(np.array(AvProfLims), "AvProfLims")
     files.save_file(np.array(invrinos), "invrinos")
コード例 #2
0
#BLheightscheck=[]
theta_jump=[]
theta_ml=[]
wstars = []
maxrmwsqs = []
rmwsqs_at_h = []
wthetas_s = []

#loop over text files files
for i in range(len(theta_file_list)):
    theta = np.genfromtxt(theta_file_list[i])
    height = np.genfromtxt(height_file)
    press = np.genfromtxt(press_file_list[i])
    rmwsq = np.genfromtxt(rmwsq_file_list[i])
    #print press.shape
    rhow = nc.calc_rhow(press, height, theta[0])
    #Now for the gradients
    dheight = np.diff(height)
    dtheta = np.diff(theta)
    
    dthetadz = np.divide(dtheta, dheight)
    
    element0 = np.array([0])
    dthetadz=np.hstack((element0, dthetadz))
        
    #only need up to 2500meters
    top_index = np.where(abs(2000 - height) < 50.)[0][0]

    #TODO: see test_lambda
    max_dtheta = np.max(dthetadz[0:top_index]) 
    max_dtheta_index = np.where(abs(dthetadz - max_dtheta)<.00006)[0][0]