Changeset 1053 for trunk/UTIL/PYTHON
- Timestamp:
- Sep 26, 2013, 1:29:22 PM (11 years ago)
- 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 22 22 import numpy as np 23 23 from scipy.ndimage.measurements import minimum_position 24 from scipy import ndimage 24 25 from netCDF4 import Dataset 25 26 import matplotlib.pyplot as plt … … 29 30 nc = Dataset(filename) 30 31 psfc = nc.variables["PSFC"] 32 print "yeah" 31 33 32 34 ### LOOP on TIME … … 39 41 stride = 20 40 42 #stride = 50 41 #stride = 10043 stride = 100 42 44 start = 0 43 45 start = stride … … 66 68 depression = np.append(depression,np.ravel(psfc2d[where])-ave) 67 69 70 ## lab is 0 or 1 68 71 lab = np.zeros(np.array(psfc2d).shape) ## points to be treated by the minimum_position routine 69 72 lab[where] = 1. ## do not treat points close to 'mean' (background) pressure 70 71 draw = False72 #draw = True73 if draw:74 ##################################################################################75 vmin = -0.376 vmax = 0.077 ndiv = 378 palette = plt.get_cmap(name="YlGnBu")79 what_I_plot = psfc2d-ave80 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.NaN93 #plt.pcolor(lab,cmap=palette)94 plt.contourf(lab,2,cmap=palette)95 plt.show()96 ##################################################################################97 73 98 74 xx = [] … … 151 127 #save = False 152 128 pression = False 153 #pression = True129 pression = True 154 130 155 131 filename = "/home/aymeric/Big_Data/psfc_f18.nc" 156 132 157 133 if save: 134 ### getsize 158 135 allsizesx, allsizesy, depression = getsize(filename) 159 136 ### sauvegarde texte pour inspection … … 162 139 mym.writeascii(depression,'alldepression.txt') 163 140 ### 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() 173 144 174 145 ### load files
Note: See TracChangeset
for help on using the changeset viewer.