Changeset 1070 for trunk/UTIL/PYTHON


Ignore:
Timestamp:
Oct 14, 2013, 5:36:36 PM (11 years ago)
Author:
aslmd
Message:

PYTHON. updated analysis tools for dust devils.

Location:
trunk/UTIL/PYTHON/powerlaw
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/powerlaw/ddhist.py

    r1053 r1070  
    55import scipy.optimize as sciopt
    66
    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"
    1322
    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
     26case = "188324p"
     27case = "191798"
     28case = "160564p"
     29case = "156487"
     30case = "2007p"
     31case = "13526p"
     32case = "172097"
     33namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_1.txt"
     34
     35
     36
    2237drop = False ; typefit=1
    2338#drop = True ; typefit=1
     
    2540##########################################################
    2641## define bins (we expect fit do not depend too much on this -- to be checked)
    27 ##nbins = 7 ; www = 3.
     42nbins = 7 ; www = 3.
    2843#nbins = 10 ; www = 2.5
    29 nbins = 15 ; www = 2.
     44#nbins = 15 ; www = 2.
    3045##nbins = 20 ; www = 1.75
    3146##nbins = 30 ; www = 1.5
    3247##nbins = 50 ; www = 1.2
     48##########################################################
     49limrest = 4. # restrict limit (multiple of dx)
     50#limrest = 2.
     51#limrest = 3.
     52#limrest = 0.
    3353##########################################################
    3454
     
    5676# restrictions
    5777restrict = (s > 0) # initialization (True everywhere)
     78restrict = restrict*(s >= limrest*dx) # remove lowest sizes (detection limit)
    5879#restrict = restrict*(np.abs(i-j) <= 6.*dx) # condition sur i,j (width,height)
    5980#restrict = restrict*(d > 0.9) # limit on drop for size (casse la power law? seulement si keep smaller devils)
    6081#restrict = restrict*(d > 0.5)
    61 #restrict = restrict*(s >= 3.*dx) # remove lowest sizes (detection limit)
    6282var = var[restrict]
    6383
     
    7696print "min %5.2e // max %5.2e" % (np.min(var),np.max(var))
    7797for 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]))
    7999
    80100# fitting function to superimpose
  • trunk/UTIL/PYTHON/powerlaw/ddstat.py

    r1053 r1070  
    1212#namefile = "/home/aymeric/Big_Data/LES_dd/psfc_oldinsight100m.ncm1_2.txt"
    1313##########################################################
     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
     27namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_2.txt"
     28
     29
     30
     31
    1432
    1533# load data
  • trunk/UTIL/PYTHON/powerlaw/dropsize.py

    r1053 r1070  
    1313##########################################################
    1414
    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"
    2722
    28 drop = ppplot.plot1d() ; drop.field = d ; drop.absc = s
    29 drop.lstyle = '' ; drop.marker = '.' ; drop.color = 'r' ; drop.fmt = "%.1f"
     23
     24namefile = "/planeto/aslmd/LESdata/"+case+".ncm1_1.txt"
     25
     26# load data
     27data = np.loadtxt(namefile,delimiter=";")
     28t = data[:,0] ; s = data[:,1] ; d = data[:,2]
     29i = data[:,3] ; j = data[:,4] # int?
     30
     31drop = ppplot.plot1d() ; drop.f = d ; drop.x = s
     32drop.linestyle = '' ; drop.marker = '.' ; drop.color = 'r' ; drop.fmt = "%.1f"
    3033drop.xlabel = "Vortex size (m)" ; drop.ylabel = "Pressure drop (Pa)"
    31 drop.make() ; ppplot.save()
     34drop.makeshow()
    3235
  • trunk/UTIL/PYTHON/powerlaw/finddd.py

    r1053 r1070  
    11#! /usr/bin/env python
    2 from ppclass import pp
     2from ppclass import pp,ncattr
    33from ppplot import plot2d,save,writeascii
    44import numpy as np
     
    1919###############################################################################
    2020def finddd(filefile,\
    21            timelist,\
    22            dx=50.,\
     21           timelist=None,\
    2322           dt_out=50.,\
    2423           lt_start=8.,\
    25            halolim=30.,\
     24           halolim=None,\
    2625           method=1,\
    2726           plotplot=False,\
     
    5251        myfile2 = open(filefile+'m'+str(method)+'_'+'2.txt', 'w')
    5352    ###############################################################################
    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
    5562    ## mean and std calculations
    5663    ## -- std is used in both methods for limits
     
    7279    print "**************************************************************"
    7380   
     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
    7487    ## LOOP ON TIME
    7588    for time in timelist:
     
    8093     #ustm = pp(file=filefile,var="USTM",t=time).getf()
    8194
    82      ## MAIN ANALYSIS. LOOP ON FAC.
    83      for fac in faclist:
    84      #fac = 3.75
    85      #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]:
    8699 
    87100      ## initialize arrays
  • trunk/UTIL/PYTHON/powerlaw/performdd.py

    r1053 r1070  
    11#! /usr/bin/env python
    22from finddd import finddd
     3
     4finddd("/planeto/aslmd/LESdata/case_A_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     5
     6exit()
     7
     8# LES_DUST_DEVIL_OLDPHYSok
     9finddd("/planeto/aslmd/LESdata/188324p.nc",dt_out=50.,lt_start=9.)
     10# LES
     11finddd("/planeto/aslmd/LESdata/160564p.nc",dt_out=50.,lt_start=9.)
     12finddd("/planeto/aslmd/LESdata/156487.nc",dt_out=50.,lt_start=8.)
     13# LES_INSIGHT
     14finddd("/planeto/aslmd/LESdata/2007p.nc",dt_out=10.,lt_start=6.)
     15finddd("/planeto/aslmd/LESdata/13526p.nc",dt_out=10.,lt_start=6.)
     16# EXOMARSshear
     17finddd("/planeto/aslmd/LESdata/172097.nc",dt_out=50.,lt_start=13.)
     18# QJ cases
     19finddd("/planeto/aslmd/LESdata/case_A_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     20finddd("/planeto/aslmd/LESdata/case_B_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     21finddd("/planeto/aslmd/LESdata/case_C_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     22finddd("/planeto/aslmd/LESdata/case_I_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     23finddd("/planeto/aslmd/LESdata/case_HIGH_50m_145_145_201_12km.nc",dt_out=100.,lt_start=8.)
     24
     25#####################################################################
     26#####################################################################
     27#####################################################################
     28
    329
    430####################
     
    834####################
    935####################
    10 
    1136
    1237#finddd("/home/aymeric/Big_Data/LES_dd/psfc_f18.nc",range(0,591,10),method=2)
     
    2247####################
    2348####################
    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)
    2550#timelist = [28.,48.,49.]
    2651#plotplot = True
     
    3257####################
    3358#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)
    3560###halolim 50 idem
    3661####################
Note: See TracChangeset for help on using the changeset viewer.