Changeset 864
- Timestamp:
- Jan 24, 2013, 12:45:30 PM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r822 r864 549 549 ##### strangely enough this does not work for api or ncrcat results! 550 550 zesol = plus_in_month[ int(zetime[5]+zetime[6])-1 ] + int(zetime[8]+zetime[9]) - 1 ##les sols GCM commencent a 0 551 dals = int( 10. * sol2ls ( zesol ) ) / 10.551 dals = int(sol2ls ( zesol )) #int( 10. * sol2ls ( zesol ) ) / 10. 552 552 ### 553 553 zetime2 = nc.variables['Times'][1] … … 830 830 u = smooth(u,csmooth) 831 831 v = smooth(v,csmooth) 832 widthvec = 0.00 3 #0.005 #0.003832 widthvec = 0.004 #0.003 #0.005 #0.003 833 833 q = plt.quiver( x[::stride,::stride],\ 834 834 y[::stride,::stride],\ … … 912 912 else: errormess("projection not supported.") 913 913 fontsizemer = int(mpl.rcParams['font.size']*3./4.) 914 if zewidth > 60000. :914 if zewidth > 60000. or char in ["npstere","spstere","ortho"]: 915 915 if char in ["cyl","lcc","merc","nsper","laea"]: step = findstep(wlon) 916 916 else: step = 10. … … 935 935 m.drawparallels(np.r_[-1.:1.:0.05], labels=[1,0,0,0], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, fmt='%5.2f') 936 936 else: ## GLOBAL OR REGIONAL MODE 937 m.drawmeridians(np.r_[- 180.:180.:steplon], labels=[0,0,0,1], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, latmax=zelatmax)938 m.drawparallels(np.r_[- 90.:90.:step], labels=[1,0,0,0], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, latmax=zelatmax)937 m.drawmeridians(np.r_[-360.:360.:steplon], labels=[0,0,0,1], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, latmax=zelatmax) 938 m.drawparallels(np.r_[-180.:180.:step], labels=[1,0,0,0], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, latmax=zelatmax) 939 939 if back: 940 940 if back not in ["coast","sea"]: m.warpimage(marsmap(back),scale=0.75) … … 1154 1154 "def": "black",\ 1155 1155 "vis": "yellow",\ 1156 "vishires": " green",\1156 "vishires": "blue",\ 1157 1157 "molabw": "yellow",\ 1158 1158 "mola": "black",\ 1159 1159 "gist_heat": "white",\ 1160 "hot": "tk",\1161 1160 "gist_rainbow": "black",\ 1162 1161 "spectral": "black",\ -
trunk/UTIL/PYTHON/planetoplot.py
r824 r864 106 106 from itertools import cycle 107 107 import os 108 from scipy import ndimage 108 109 109 110 ######################### … … 133 134 nlon, nlat, nvert, ntime, mapmode, nslices = determineplot(slon, slat, svert, stime, redope) 134 135 zelen = len(namefiles)*len(var) 136 ### we have a special mode obtained by -p noproj in which lat/lon plots are just flat 2D plots 137 if proj == "noproj": mapmode = 0 135 138 ### we correct number of plot fields for possible operation (substract, etc...) 136 139 if ope is not None: … … 188 191 [lon2d,lat2d] = getcoorddef(nc) 189 192 ### we get an adapted map projection if none is provided by the user 190 if proj == None: proj = getproj(nc) 193 if proj == None: proj = getproj(nc) 191 194 ### we define plot boundaries given projection or user choices 192 195 if firstfile: … … 282 285 lonp,latp = ( lon2d[indices[0,0,0],indices[0,0,1]] , lat2d[indices[0,0,0],indices[0,0,1]] ) 283 286 ### we get rid of boundary relaxation zone for plots. important to do that now and not before. 284 if typefile in ['meso'] and mapmode == 1:287 if (typefile in ['meso'] and mapmode == 1): 285 288 if '9999' not in getattr(nc,'START_DATE'): lon2d = dumpbdy(lon2d,6) ; lat2d = dumpbdy(lat2d,6) 286 289 ### we read the keyword for vertical dimension. we take care for vertical staggering. … … 553 556 # now that the section is determined we can set the real lat 554 557 # ... or for now, a temptative one. 555 if slon is not None: latyeah = lat2d[:,0] 556 if slat is not None: lonyeah = lon2d[0,:] 558 milieux = int(lat2d.shape[1]/2.) 559 milieuy = int(lat2d.shape[0]/2.) 560 if slon is not None or proj == "noproj": latyeah = lat2d[:,milieux] 561 if slat is not None or proj == "noproj": lonyeah = lon2d[milieuy,:] 557 562 what_I_plot, x, y = define_axis(lonyeah,latyeah,vert,time,indexlon,indexlat,indexvert,\ 558 563 itime,what_I_plot, len(all_var[index_f].shape),vertmode,redope) 564 ### 565 if analysis in ['laplace']: what_I_plot = ndimage.laplace(what_I_plot) 559 566 ### 560 567 if (fileref is not None) and ((index_f+1)%3 == 0): zevmin, zevmax = calculate_bounds(what_I_plot,vmin=minop,vmax=maxop) … … 609 616 m = define_proj(proj,wlon,wlat,back=back,blat=blat,blon=blon) ## this is dirty, defined above but out of imov loop 610 617 x, y = m(lon2d, lat2d) ## this is dirty, defined above but out of imov loop 611 if typefile in ['meso'] and mapmode == 1:618 if (typefile in ['meso'] and mapmode == 1): 612 619 if '9999' not in getattr(nc,'START_DATE'): what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True) 613 620 # if typefile in ['mesoideal']: what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag) … … 633 640 if this_is_a_regular_plot: plot(x,what_I_plot_frame,zeline,label=lbl,marker=zemarker) ## vertical profile 634 641 else: plot(what_I_plot_frame,x,zeline,label=lbl,marker=zemarker) ## regular plot 642 mpl.pyplot.grid(True) 635 643 if nplot > 1: legend(loc='best') 636 644 if indextime is None and axtime is not None and xlab is None: xlabel(axtime.upper()) ## define the right label … … 935 943 #### Getting more out of this video -- PROBLEMS WITH CREATED VIDEOS 936 944 # 937 #if mrate is not None:938 #print "Re-encoding movie.. first pass"939 # video.first_pass(filename=moviename,quality=mquality,rate=mrate)945 if mrate is not None and save != "html": 946 print "Re-encoding movie.. first pass" 947 video.first_pass(filename=zeplot,quality=mquality,rate=mrate) 940 948 # print "Re-encoding movie.. second pass" 941 949 # video.second_pass(filename=moviename,quality=mquality,rate=mrate) -
trunk/UTIL/PYTHON/pp.py
r822 r864 189 189 #if typefile not in ["meso","mesoapi"]: name = 'pycommand' 190 190 if opt.save == "gui": name = 'pycommand' 191 elif opt.save == "avi": system("mv -f movie*.avi "+name+".avi")192 191 elif opt.save == "html": system("cat $PYTHONPATH/header.html > anim.html ; cat zepics >> anim.html ; cat $PYTHONPATH/body.html >> anim.html ; rm -rf zepics "+name+" ; mkdir "+name+" ; mv anim.html image*png "+name) 193 192 f = open(name+'.sh', 'w') -
trunk/UTIL/PYTHON/videosink.py
r448 r864 29 29 if quality:bitrate="50000" 30 30 cmdstring = ('mencoder', 31 filename+'_raw.avi',32 '-of', ' rawvideo',31 'movie_raw.avi', 32 '-of', 'avi', 33 33 '-nosound', 34 34 '-ofps',str(rate), … … 36 36 '-x264encopts', 'subq=1:frameref=1:bitrate='+bitrate+':bframes=1:pass=1', 37 37 '-vf', 'scale=1280:720', 38 '-o', filename+' _first.264'38 '-o', filename+'.avi' 39 39 ) 40 ## si second_pass '-o', filename+'_first.264' 41 ## ... et seconde ligne: filename+'_raw.avi' 40 42 subprocess.call(cmdstring,shell=False) 41 43
Note: See TracChangeset
for help on using the changeset viewer.