Changeset 310 for trunk/MESOSCALE
- Timestamp:
- Sep 29, 2011, 3:59:01 PM (13 years ago)
- Location:
- trunk/MESOSCALE/LMD_MM_MARS/SRC
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/2dplot.py
r296 r310 26 26 #title = "Atmospheric temperature" 27 27 28 name = "wrfout_d01_2024-03-22_01:00:00_z" 29 itime = 12 30 ndiv = 10 31 zey = 120 32 var = "VMR_ICE" 33 title = "Volume mixing ratio of water ice [ppm]" 34 vmin = -0.5 35 vmax = 400. 36 28 37 nc = Dataset(name) 29 38 30 39 what_I_plot, error = reducefield( getfield(nc,var), d4=itime, d2=zey ) 40 31 41 32 42 y = nc.variables["vert"][:] … … 34 44 horinp = len(what_I_plot[0,:]) 35 45 x = np.linspace(0.,horinp*500.,horinp) / 1000. 46 xlabel("Horizontal coordinate (km)") 47 48 horinp = len(what_I_plot[0,:]) 49 x = np.linspace(0.,horinp,horinp) 50 xlabel("x grid points") 51 36 52 37 53 zevmin, zevmax = calculate_bounds(what_I_plot,vmin=vmin,vmax=vmax) … … 46 62 extend='neither',spacing='proportional') 47 63 ptitle(title) 48 xlabel("Horizontal coordinate (km)")49 64 ylabel("Altitude (m)") 50 65 makeplotres(var+str(itime),res=200.,disp=False) -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/examples/scripts/find_devils.py
r251 r310 23 23 from scipy.ndimage.measurements import minimum_position 24 24 from netCDF4 import Dataset 25 25 import matplotlib.pyplot as plt 26 import myplot as myp 27 26 28 ### LOAD NETCDF DATA 27 29 filename = "psfc.nc" … … 34 36 allsizesx = [] 35 37 allsizesy = [] 36 for i in range(0,shape[0]): 37 #for i in range(0,2): 38 39 print i, ' on ', shape[0] 38 stride = 1 #5 39 for i in range(0,shape[0],stride): 40 40 41 psfc2d = np.array ( psfc [ i, : , : ] ) 41 42 42 43 ############### CRITERION 43 ave = np.mean(psfc2d,dtype=np.float64) ## dtype otherwise inaccuracy 44 where = np.where(psfc2d - ave < -0.3) ## comme le papier Phoenix 44 ave = np.mean(psfc2d,dtype=np.float64) ## dtype otherwise inaccuracy 45 46 #limdp = -0.2 ## on en loupe pas mal 47 #where = np.where(psfc2d - ave < limdp) ## comme le papier Phoenix 45 48 46 std = np.std(psfc2d,dtype=np.float64) ## dtype otherwise inaccuracy 47 fac = 2.5 ## not too low, otherwise vortices are not caught. 4 good choice. 49 std = np.std(psfc2d,dtype=np.float64) ## dtype otherwise inaccuracy 50 fac = 4. ## how many sigmas. not too low, otherwise vortices are not caught. 4 good choice. 51 ## 2.5 clearly too low, 3.5 not too bad, 4 probably good 52 fac = 3.5 53 #fac = 2.5 48 54 lim = ave - fac*std 49 print lim, ave, std50 55 where = np.where(psfc2d < lim) 51 56 ############### END CRITERION 52 57 53 58 lab = np.zeros(np.array(psfc2d).shape) ## points to be treated by the minimum_position routine 54 59 lab[where] = 1. ## do not treat points close to 'mean' (background) pressure 55 60 61 draw = False 62 if draw: 63 ################################################################################## 64 vmin = -0.3 65 vmax = 0.0 66 ndiv = 3 67 palette = plt.get_cmap(name="YlGnBu") 68 what_I_plot = psfc2d-ave 69 zevmin, zevmax = myp.calculate_bounds(what_I_plot,vmin=vmin,vmax=vmax) 70 what_I_plot = myp.bounds(what_I_plot,zevmin,zevmax) 71 zelevels = np.linspace(zevmin,zevmax) 72 fig = plt.figure() 73 sub = myp.definesubplot(2,fig) 74 plt.subplot(sub) 75 plt.contourf(what_I_plot,zelevels,cmap=palette) 76 plt.colorbar(fraction=0.05,pad=0.03,format="%.1f",\ 77 ticks=np.linspace(zevmin,zevmax,ndiv+1),\ 78 extend='both',spacing='proportional') 79 plt.subplot(sub+1) 80 palette = plt.get_cmap(name="binary") 81 plt.contourf(lab,2,cmap=palette) 82 plt.show() 83 ################################################################################## 84 56 85 xx = [] 57 86 yy = [] … … 69 98 sizex = detsize( xx, res = 10, loga=False, thres=2 ) 70 99 sizey = detsize( yy, res = 10, loga=False, thres=2 ) 100 #sizex = detsize( xx, res = 10, loga=False, thres=3 ) 101 #sizey = detsize( yy, res = 10, loga=False, thres=3 ) 71 102 ### 103 #if ( mym.max(sizex) > mym.max(sizey) ): sizey = sizex ### un peu limite dans certains cas 104 if (len(sizex) > len(sizey)) : sizey = sizex ### plus fidele mais petit souci lorsque PBC 105 elif (len(sizex) == len(sizey)) : 106 if ( mym.max(sizex) > mym.max(sizey) ): sizey = sizex 107 else : sizex = sizey 108 else : sizex = sizey 72 109 allsizesx = np.append(allsizesx,sizex) 73 110 allsizesy = np.append(allsizesy,sizey) 111 print i, ' on ', shape[0], ' caught ', len(sizex), ' vortices ', sizex 74 112 ######## 75 113 76 114 allsizesx.sort() 77 115 allsizesy.sort() … … 79 117 return allsizesx, allsizesy 80 118 81 def writeascii ( tab, filename ): 82 mydata = tab 83 myfile = open(filename, 'w') 84 for line in mydata: 85 myfile.write(str(line) + '\n') 86 myfile.close() 87 return 119 ######################################################################### 120 ######################################################################### 88 121 89 122 import matplotlib.pyplot as plt … … 91 124 import numpy as np 92 125 import matplotlib.mlab as mlab 126 import mymath as mym 93 127 94 128 save = True 95 #save = False 129 save = False 130 96 131 if save: 97 132 allsizesx, allsizesy = getsize("psfc.nc") 98 writeascii(allsizesx,'allsizex.txt') 99 writeascii(allsizesy,'allsizey.txt') 100 133 ### sauvegarde texte pour inspection 134 mym.writeascii(allsizesx,'allsizex.txt') 135 mym.writeascii(allsizesy,'allsizey.txt') 136 ### sauvegarde binaire pour utilisation python 101 137 myfile = open('allsizex.bin', 'wb') 102 138 pickle.dump(allsizesx, myfile) 103 139 myfile.close() 104 105 140 myfile = open('allsizey.bin', 'wb') 106 141 pickle.dump(allsizesy, myfile) 107 142 myfile.close() 108 143 109 144 ### load files 110 145 myfile = open('allsizex.bin', 'r') 111 146 allsizesx = pickle.load(myfile) … … 113 148 allsizesy = pickle.load(myfile) 114 149 150 ### append sizes 115 151 plothist = np.append(allsizesx,allsizesy) 152 plothist = allsizesx 153 #plothist = allsizesy 116 154 plothist.sort() 117 155 118 nbins=100 156 ### make bins 157 nbins = 100 119 158 zebins = [2.0] 159 #nbins = 8 160 #zebins = [19.0] 161 #nbins = 15 162 #zebins = [11.] ##12 non mais donne un peu la meme chose 163 #zebins = [20.] ##20 non car trop pres du premier 164 nbins = 100 165 zebins = [2./np.sqrt(2.)] ## ne pas tomber sur une dizaine ronde 166 nbins = 200 167 zebins = [0.2/np.sqrt(2.)] ## ne pas tomber sur une dizaine ronde 168 120 169 for i in range(0,nbins): zebins.append(zebins[i]*np.sqrt(2)) 121 170 zebins = np.array(zebins) 122 print zebins 123 171 ### select reasonable bins for DD 124 172 zebins = zebins [ zebins > 10. ] 125 173 zebins = zebins [ zebins < 1000. ] 126 print zebins 174 #print 'bins ',zebins 175 print 'corrected bins ',zebins 176 print 'max value ',mym.max(plothist),mym.max(allsizesx),mym.max(allsizesy) 177 178 #plothist = [20.,30.,40.,50.,70.,100.,130.,190.,260.,370.,520.] ## pour calibrer 127 179 128 180 #### HISTOGRAM … … 130 182 log=True,\ 131 183 bins=zebins,\ 132 #cumulative=-1,\184 # cumulative=-1,\ 133 185 ) 134 186 plt.xscale('log') 135 136 187 plt.show() 137 188 -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/mymath.py
r261 r310 14 14 return u'\u00b0' 15 15 16 def writeascii ( tab, filename ): 17 mydata = tab 18 myfile = open(filename, 'w') 19 for line in mydata: 20 myfile.write(str(line) + '\n') 21 myfile.close() 22 return 23 -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/myplot.py
r296 r310 450 450 from mymath import max,min,mean 451 451 ### might be convenient to add the missing value in arguments 452 what_I_plot[ what_I_plot < zevmin ] = zevmin*(1. + 1.e-7) 452 #what_I_plot[ what_I_plot < zevmin ] = zevmin#*(1. + 1.e-7) 453 if zevmin < 0: what_I_plot[ what_I_plot < zevmin*(1. - 1.e-7) ] = zevmin*(1. - 1.e-7) 454 else: what_I_plot[ what_I_plot < zevmin*(1. + 1.e-7) ] = zevmin*(1. + 1.e-7) 453 455 print "new min ", min(what_I_plot) 454 456 what_I_plot[ what_I_plot > 9e+35 ] = -9e+35 455 what_I_plot[ what_I_plot > zevmax ] = zevmax *(1. - 1.e-7)457 what_I_plot[ what_I_plot > zevmax ] = zevmax 456 458 print "new max ", max(what_I_plot) 459 457 460 return what_I_plot 458 461 … … 508 511 "USTM": "YlOrRd",\ 509 512 "HFX": "RdYlBu",\ 510 "ICETOT": "YlGnBu ",\513 "ICETOT": "YlGnBu_r",\ 511 514 "MTOT": "PuBu",\ 512 515 "TAU_ICE": "Blues",\ -
trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new_storm/libf/phymars/STORM_JULIEN_LAST/aeropacity_tachemobile_z.F
r309 r310 497 497 ztoploc = 10 ! target pseudo-altitude of local storm (km) 498 498 radloc = 0.5 ! radius of dust storm (degree) 499 lonloc = 80! center longitude of storm (deg)500 latloc = - 25! center latitude of storm (deg)499 lonloc = 25. ! center longitude of storm (deg) 500 latloc = -3. ! center latitude of storm (deg) 501 501 502 502 DO ig=1,ngrid -
trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new_storm/libf/phymars/initracer.F
r308 r310 1 link ../../../mars_lmd_new/libf/phymars/initracer.F1 link STORM_JULIEN_LAST/initracer.F
Note: See TracChangeset
for help on using the changeset viewer.