Changeset 1070 for trunk/UTIL/PYTHON
- Timestamp:
- Oct 14, 2013, 5:36:36 PM (11 years ago)
- Location:
- trunk/UTIL/PYTHON/powerlaw
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/powerlaw/ddhist.py
r1053 r1070 5 5 import scipy.optimize as sciopt 6 6 7 ## SAVED 8 namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm2_1.txt" ; drop = False ; typefit=1 9 namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm2_1.txt" ; drop = True ; typefit=2 10 namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm1_1.txt" ; drop = False ; typefit=1 11 namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm1_1.txt" ; drop = True ; typefit=1 12 namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc.LMD_LES_MARS.160564.ncm2_1.txt" ; drop = False ; typefit=1 #bof. tous les 10 est mieux. 7 ### SAVED 8 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm2_1.txt" ; drop = False ; typefit=1 9 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm2_1.txt" ; drop = True ; typefit=2 10 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm1_1.txt" ; drop = False ; typefit=1 11 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc_f18.ncm1_1.txt" ; drop = True ; typefit=1 12 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc.LMD_LES_MARS.160564.ncm2_1.txt" ; drop = False ; typefit=1 #bof. tous les 10 est mieux. 13 # 14 ########################################################### 15 ##namefile = "/home/aymeric/Big_Data/LES_dd/psfc_f18.ncm1_1.txt" 16 ##namefile = "/home/aymeric/Big_Data/LES_dd/psfc_f18.ncm2_1.txt" 17 ##namefile = "/home/aymeric/Big_Data/LES_dd/psfc.LMD_LES_MARS.160564.ncm1_1.txt" 18 ##namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc.LMD_LES_MARS.160564.ncm2_1.txt" 19 #namefile = "/home/aymeric/Big_Data/LES_dd/press_ustm_exomars.nc1.txt" 20 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/press_ustm_exomars.ncm2_1.txt" 21 ##namefile = "/home/aymeric/Big_Data/LES_dd/psfc_oldinsight100m.ncm1_1.txt" 13 22 14 ########################################################## 15 #namefile = "/home/aymeric/Big_Data/LES_dd/psfc_f18.ncm1_1.txt" 16 #namefile = "/home/aymeric/Big_Data/LES_dd/psfc_f18.ncm2_1.txt" 17 #namefile = "/home/aymeric/Big_Data/LES_dd/psfc.LMD_LES_MARS.160564.ncm1_1.txt" 18 #namefile = "/home/aymeric/Big_Data/LES_dd/sav/psfc.LMD_LES_MARS.160564.ncm2_1.txt" 19 namefile = "/home/aymeric/Big_Data/LES_dd/press_ustm_exomars.nc1.txt" 20 namefile = "/home/aymeric/Big_Data/LES_dd/sav/press_ustm_exomars.ncm2_1.txt" 21 #namefile = "/home/aymeric/Big_Data/LES_dd/psfc_oldinsight100m.ncm1_1.txt" 23 24 25 26 case = "188324p" 27 case = "191798" 28 case = "160564p" 29 case = "156487" 30 case = "2007p" 31 case = "13526p" 32 case = "172097" 33 namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_1.txt" 34 35 36 22 37 drop = False ; typefit=1 23 38 #drop = True ; typefit=1 … … 25 40 ########################################################## 26 41 ## define bins (we expect fit do not depend too much on this -- to be checked) 27 ##nbins = 7 ; www = 3.42 nbins = 7 ; www = 3. 28 43 #nbins = 10 ; www = 2.5 29 nbins = 15 ; www = 2.44 #nbins = 15 ; www = 2. 30 45 ##nbins = 20 ; www = 1.75 31 46 ##nbins = 30 ; www = 1.5 32 47 ##nbins = 50 ; www = 1.2 48 ########################################################## 49 limrest = 4. # restrict limit (multiple of dx) 50 #limrest = 2. 51 #limrest = 3. 52 #limrest = 0. 33 53 ########################################################## 34 54 … … 56 76 # restrictions 57 77 restrict = (s > 0) # initialization (True everywhere) 78 restrict = restrict*(s >= limrest*dx) # remove lowest sizes (detection limit) 58 79 #restrict = restrict*(np.abs(i-j) <= 6.*dx) # condition sur i,j (width,height) 59 80 #restrict = restrict*(d > 0.9) # limit on drop for size (casse la power law? seulement si keep smaller devils) 60 81 #restrict = restrict*(d > 0.5) 61 #restrict = restrict*(s >= 3.*dx) # remove lowest sizes (detection limit)62 82 var = var[restrict] 63 83 … … 76 96 print "min %5.2e // max %5.2e" % (np.min(var),np.max(var)) 77 97 for iii in range(len(zebins)-1): 78 print "%5.2e in [%5. 2e %5.2e]" % (yeah[0][iii],zebins[iii],zebins[iii+1])98 print "%5.2e in [%5.0f %5.0f] %5.0f" % (yeah[0][iii],zebins[iii],zebins[iii+1],np.abs(zebins[iii+1]-zebins[iii])) 79 99 80 100 # fitting function to superimpose -
trunk/UTIL/PYTHON/powerlaw/ddstat.py
r1053 r1070 12 12 #namefile = "/home/aymeric/Big_Data/LES_dd/psfc_oldinsight100m.ncm1_2.txt" 13 13 ########################################################## 14 15 16 17 18 #case = "188324p" 19 #case = "191798" 20 #case = "160564p" 21 #case = "156487" 22 #case = "2007p" 23 #case = "13526p" 24 #case = "172097" 25 26 27 namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_2.txt" 28 29 30 31 14 32 15 33 # load data -
trunk/UTIL/PYTHON/powerlaw/dropsize.py
r1053 r1070 13 13 ########################################################## 14 14 15 # read data np.loadtxt? 16 ## import pylab as plb data = plb.loadtxt('data.dat') x = data[:,0] y= data[:,1] 17 f = open(namefile,'r') 18 t = [] ; s = [] ; d = [] ; i = [] ; j = [] 19 for line in f: 20 ct,cs,cd,ci,cj = line.strip().split(';') 21 t.append(float(ct)) 22 s.append(float(cs)) ; d.append(float(cd)) 23 i.append(int(ci)) ; j.append(int(cj)) 24 f.close() 25 # ensure numpy array 26 t = np.array(t) ; s = np.array(s) ; d = np.array(d) ; i = np.array(i) ; j = np.array(j) 15 #case = "188324p" 16 #case = "191798" 17 #case = "160564p" 18 #case = "156487" 19 #case = "2007p" 20 #case = "13526p" 21 #case = "172097" 27 22 28 drop = ppplot.plot1d() ; drop.field = d ; drop.absc = s 29 drop.lstyle = '' ; drop.marker = '.' ; drop.color = 'r' ; drop.fmt = "%.1f" 23 24 namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_1.txt" 25 26 # load data 27 data = np.loadtxt(namefile,delimiter=";") 28 t = data[:,0] ; s = data[:,1] ; d = data[:,2] 29 i = data[:,3] ; j = data[:,4] # int? 30 31 drop = ppplot.plot1d() ; drop.f = d ; drop.x = s 32 drop.linestyle = '' ; drop.marker = '.' ; drop.color = 'r' ; drop.fmt = "%.1f" 30 33 drop.xlabel = "Vortex size (m)" ; drop.ylabel = "Pressure drop (Pa)" 31 drop.make () ; ppplot.save()34 drop.makeshow() 32 35 -
trunk/UTIL/PYTHON/powerlaw/finddd.py
r1053 r1070 1 1 #! /usr/bin/env python 2 from ppclass import pp 2 from ppclass import pp,ncattr 3 3 from ppplot import plot2d,save,writeascii 4 4 import numpy as np … … 19 19 ############################################################################### 20 20 def finddd(filefile,\ 21 timelist,\ 22 dx=50.,\ 21 timelist=None,\ 23 22 dt_out=50.,\ 24 23 lt_start=8.,\ 25 halolim= 30.,\24 halolim=None,\ 26 25 method=1,\ 27 26 plotplot=False,\ … … 52 51 myfile2 = open(filefile+'m'+str(method)+'_'+'2.txt', 'w') 53 52 ############################################################################### 54 53 54 ## get the resolution within the file 55 dx = ncattr(filefile,'DX') ; print "resolution in meters is: ",dx 56 ## if no halolim is given, guess it from resolution 57 if halolim is None: 58 extentlim = 2000. # the putative maximum extent of a vortex in m 59 halolim = extentlim / dx 60 print "maximum halo size is: ",halolim 61 55 62 ## mean and std calculations 56 63 ## -- std is used in both methods for limits … … 72 79 print "**************************************************************" 73 80 81 # if no timelist is given, take them all 82 if timelist is None: 83 sizet = psfc.shape[0] 84 print "treat all time values: ",sizet 85 timelist = range(0,sizet-1,1) 86 74 87 ## LOOP ON TIME 75 88 for time in timelist: … … 80 93 #ustm = pp(file=filefile,var="USTM",t=time).getf() 81 94 82 ## MAIN ANALYSIS. LOOP ON FAC. 83 for fac in faclist:84 #fac = 3.7585 #for method in [2,1]:95 ## MAIN ANALYSIS. LOOP ON FAC. OR METHOD. 96 #for fac in faclist: 97 fac = 3.75 98 for method in [2,1]: 86 99 87 100 ## initialize arrays -
trunk/UTIL/PYTHON/powerlaw/performdd.py
r1053 r1070 1 1 #! /usr/bin/env python 2 2 from finddd import finddd 3 4 finddd("/planeto/aslmd/LESdata/case_A_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 5 6 exit() 7 8 # LES_DUST_DEVIL_OLDPHYSok 9 finddd("/planeto/aslmd/LESdata/188324p.nc",dt_out=50.,lt_start=9.) 10 # LES 11 finddd("/planeto/aslmd/LESdata/160564p.nc",dt_out=50.,lt_start=9.) 12 finddd("/planeto/aslmd/LESdata/156487.nc",dt_out=50.,lt_start=8.) 13 # LES_INSIGHT 14 finddd("/planeto/aslmd/LESdata/2007p.nc",dt_out=10.,lt_start=6.) 15 finddd("/planeto/aslmd/LESdata/13526p.nc",dt_out=10.,lt_start=6.) 16 # EXOMARSshear 17 finddd("/planeto/aslmd/LESdata/172097.nc",dt_out=50.,lt_start=13.) 18 # QJ cases 19 finddd("/planeto/aslmd/LESdata/case_A_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 20 finddd("/planeto/aslmd/LESdata/case_B_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 21 finddd("/planeto/aslmd/LESdata/case_C_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 22 finddd("/planeto/aslmd/LESdata/case_I_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 23 finddd("/planeto/aslmd/LESdata/case_HIGH_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.) 24 25 ##################################################################### 26 ##################################################################### 27 ##################################################################### 28 3 29 4 30 #################### … … 8 34 #################### 9 35 #################### 10 11 36 12 37 #finddd("/home/aymeric/Big_Data/LES_dd/psfc_f18.nc",range(0,591,10),method=2) … … 22 47 #################### 23 48 #################### 24 finddd("/home/aymeric/Big_Data/LES_dd/press_ustm_exomars.nc",range(0,54,1),dx=12.,halolim=100,method=2)49 #finddd("/planeto/aslmd/LESdata/press_ustm_exomars.nc",range(0,54,1),halolim=100,method=2) 25 50 #timelist = [28.,48.,49.] 26 51 #plotplot = True … … 32 57 #################### 33 58 #finddd("/home/aymeric/Big_Data/LES_dd/psfc.LMD_LES_MARS.160564.nc",\ 34 # range(0,336,1), dx=10.,lt_start=9.,halolim=150,method=2)59 # range(0,336,1),lt_start=9.,halolim=150,method=2) 35 60 ###halolim 50 idem 36 61 ####################
Note: See TracChangeset
for help on using the changeset viewer.