Changeset 1053 for trunk/UTIL


Ignore:
Timestamp:
Sep 26, 2013, 1:29:22 PM (11 years ago)
Author:
aslmd
Message:

UTIL PYTHON. tools to study dust devils in LES.

Location:
trunk/UTIL/PYTHON/powerlaw
Files:
7 added
7 moved

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/powerlaw/previous_tests/find_devils.py

    r1032 r1053  
    2222    import numpy as np
    2323    from scipy.ndimage.measurements import minimum_position
     24    from scipy import ndimage
    2425    from netCDF4 import Dataset
    2526    import matplotlib.pyplot as plt
     
    2930    nc = Dataset(filename)
    3031    psfc = nc.variables["PSFC"]
     32    print "yeah"
    3133   
    3234    ### LOOP on TIME
     
    3941    stride = 20
    4042    #stride = 50
    41     #stride = 100
     43    stride = 100
    4244    start = 0
    4345    start = stride
     
    6668        depression = np.append(depression,np.ravel(psfc2d[where])-ave)
    6769   
     70        ## lab is 0 or 1
    6871        lab = np.zeros(np.array(psfc2d).shape) ## points to be treated by the minimum_position routine
    6972        lab[where] = 1.  ## do not treat points close to 'mean' (background) pressure
    70 
    71         draw = False
    72         #draw = True
    73         if draw:
    74         ##################################################################################
    75             vmin = -0.3
    76             vmax =  0.0
    77             ndiv = 3
    78             palette = plt.get_cmap(name="YlGnBu")
    79             what_I_plot = psfc2d-ave
    80             zevmin, zevmax = myp.calculate_bounds(what_I_plot,vmin=vmin,vmax=vmax)
    81             what_I_plot = myp.bounds(what_I_plot,zevmin,zevmax)
    82             zelevels = np.linspace(zevmin,zevmax)
    83             fig = plt.figure(figsize=(16,8))
    84             subv,subh = myp.definesubplot(2,fig)
    85             plt.subplot(subv,subh,1)
    86             plt.contourf(what_I_plot,zelevels,cmap=palette)
    87             plt.colorbar(fraction=0.05,pad=0.03,format="%.1f",\
    88                            ticks=np.linspace(zevmin,zevmax,ndiv+1),\
    89                            extend='both',spacing='proportional')
    90             plt.subplot(subv,subh,2)
    91             palette = plt.get_cmap(name="hot") #"binary")
    92             #lab[np.where(lab > 0.99)] = np.NaN
    93             #plt.pcolor(lab,cmap=palette)
    94             plt.contourf(lab,2,cmap=palette)
    95             plt.show()
    96         ##################################################################################
    9773 
    9874        xx = []
     
    151127#save = False
    152128pression = False
    153 #pression = True
     129pression = True
    154130
    155131filename = "/home/aymeric/Big_Data/psfc_f18.nc"
    156132
    157133if save:
     134    ### getsize
    158135    allsizesx, allsizesy, depression = getsize(filename)
    159136    ### sauvegarde texte pour inspection
     
    162139    mym.writeascii(depression,'alldepression.txt')
    163140    ### sauvegarde binaire pour utilisation python
    164     myfile = open('allsizex.bin', 'wb')
    165     pickle.dump(allsizesx, myfile)
    166     myfile.close()
    167     myfile = open('allsizey.bin', 'wb')
    168     pickle.dump(allsizesy, myfile)
    169     myfile.close()
    170     myfile = open('alldepression.bin', 'wb')
    171     pickle.dump(depression, myfile)
    172     myfile.close()
     141    myfile = open('allsizex.bin', 'wb') ; pickle.dump(allsizesx, myfile) ; myfile.close()
     142    myfile = open('allsizey.bin', 'wb') ; pickle.dump(allsizesy, myfile) ; myfile.close()
     143    myfile = open('alldepression.bin', 'wb') ; pickle.dump(depression, myfile) ; myfile.close()
    173144
    174145### load files
Note: See TracChangeset for help on using the changeset viewer.