Changeset 444 for trunk/UTIL/PYTHON/planetoplot.py
- Timestamp:
- Dec 1, 2011, 3:58:28 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r443 r444 52 52 tsat=False,\ 53 53 flagnolow=False,\ 54 mrate=None): 54 mrate=None,\ 55 mquality=False): 55 56 56 57 … … 73 74 from numpy.core.defchararray import find 74 75 from videosink import VideoSink 76 import subprocess 75 77 76 78 ################################ … … 153 155 if varname in ['PHTOT','W']: vertdim='BOTTOM-TOP_PATCH_END_STAG' 154 156 else: vertdim='BOTTOM-TOP_PATCH_END_UNSTAG' 157 if (var2 is not None and var2 not in ['PHTOT','W']): 158 vertdim='BOTTOM-TOP_PATCH_END_UNSTAG' 159 dumped_vert_stag=True 155 160 if varname in ['V']: latdim='SOUTH-NORTH_PATCH_END_STAG' 156 161 else: latdim='SOUTH-NORTH_PATCH_END_UNSTAG' … … 291 296 yint=yintegral, alt=vert, anomaly=anomaly ) 292 297 what_I_plot = what_I_plot*mult 293 #if typefile in ['mesoideal']: what_I_plot = dumpbdy(what_I_plot,0,stag='W')298 # if typefile in ['mesoideal']: what_I_plot = dumpbdy(what_I_plot,0,stag='W') 294 299 if not error: 295 300 fvar = varname … … 324 329 if mrate is not None: 325 330 what_I_plot_frame = what_I_plot[imov,:,:] ; print "-> frame ",imov+1 326 if mapmode == 1: 331 if mapmode == 1: 327 332 m = define_proj(proj,wlon,wlat,back=back,blat=blat) ## this is dirty, defined above but out of imov loop 328 333 x, y = m(lon2d, lat2d) ## this is dirty, defined above but out of imov loop 329 if typefile in ['mesoapi','meso'] and mapmode == 1: what_I_plot_frame = dumpbdy(what_I_plot_frame,6) 334 if typefile in ['mesoapi','meso'] and mapmode == 1: what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True) 335 if typefile in ['mesoideal']: what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag) 336 330 337 if hole: what_I_plot_frame = hole_bounds(what_I_plot_frame,zevmin,zevmax) 331 338 else: what_I_plot_frame = bounds(what_I_plot_frame,zevmin,zevmax) … … 358 365 colorbar( fraction=0.05,pad=0.03,format=daformat,\ 359 366 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,20])),extend='neither',spacing='proportional' ) 360 mframe=fig2img(mpl.pyplot.gcf()) 367 figframe=mpl.pyplot.gcf() 368 if mrate is not None: 369 if mquality: figframe.set_dpi(600.) 370 else: figframe.set_dpi(200.) 371 mframe=fig2img(figframe) 361 372 if ((mrate is not None) and (imov is 0)): 362 W,H = mpl.pyplot.gcf().canvas.get_width_height() 363 video = VideoSink((H,W), "test", rate=mrate, byteorder="rgba") 373 moviename='test' 374 W,H = figframe.canvas.get_width_height() 375 video = VideoSink((H,W), moviename, rate=mrate, byteorder="rgba") 364 376 if mrate is not None: 365 377 video.run(mframe) 366 378 mpl.pyplot.close() 367 379 imov=imov+1 368 if mrate is not None: video.close 380 if mrate is not None: video.close() 369 381 ##### 1D field 370 382 elif len(what_I_plot.shape) is 1: … … 386 398 if not error: 387 399 if typefile in ['mesoapi','meso']: 388 [vecx,vecy] = [dumpbdy(vecx,6,stag=uchar ), dumpbdy(vecy,6,stag=vchar)]400 [vecx,vecy] = [dumpbdy(vecx,6,stag=uchar,condition=True), dumpbdy(vecy,6,stag=vchar,condition=True)] 389 401 key = True 390 402 elif typefile in ['gcm']: … … 469 481 show() 470 482 483 ################################## 484 ### Getting more out of this video 485 486 if mrate is not None: 487 print "Re-encoding movie.. first pass" 488 video.first_pass(filename=moviename,quality=mquality) 489 print "Re-encoding movie.. second pass" 490 video.second_pass(filename=moviename,quality=mquality) 491 471 492 ############### 472 493 ### Now the end
Note: See TracChangeset
for help on using the changeset viewer.