Ignore:
Timestamp:
Nov 30, 2011, 7:36:50 PM (13 years ago)
Author:
aslmd
Message:

GRAPHICS: solved two problems of indentation in the two previous commits. moved the modification of indextime in the right place. other purely cosmetic changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot.py

    r433 r434  
    265265               else: errormess("local times not supported for GCM files. not too hard to modify the code though.")
    266266       if mapmode == 1 and stime is None:   indextime = 1
     267       elif mrate is not None:              indextime = None
    267268       else:                                indextime = getsindex(stime,((nplot-1)//(nlon*nlat*nvert))%ntime,time)
    268269       ltst = None
     
    273274       ticks = ndiv + 1
    274275
    275        #### Contour plot
    276        if var2:
     276       #### Contour plot -- to be activated with movies
     277       if var2 and mrate is None:
    277278           what_I_plot, error = reducefield(all_var2[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert, yint=yintegral, alt=vert)
    278279           #what_I_plot = what_I_plot*mult
     
    306307       varname = all_varname[index_f]
    307308       if varname:
    308            zindtime=indextime
    309            if mrate is not None:zindtime=None
    310            what_I_plot, error = reducefield(all_var[index_f], d4=zindtime, d1=indexlon, d2=indexlat , d3=indexvert , yint=yintegral, alt=vert, anomaly=anomaly)
     309           what_I_plot, error = reducefield(all_var[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert , yint=yintegral, alt=vert, anomaly=anomaly)
    311310           what_I_plot = what_I_plot*mult
    312311           if not error:
     
    335334               ##### simple 2D field and movies of 2D fields
    336335               if len(what_I_plot.shape) >= 2:
    337                  if (len(what_I_plot.shape) is 3 and mrate is None):
    338                     print "3D field in input but not rate specified for movie (use --rate RATE or specify --time TIME)"
    339                     print "Exiting now"
    340                     exit()
    341                  istart=0
    342                  if mrate is not None:iend=len(time)-1
    343                  else:iend=istart
     336                 if (len(what_I_plot.shape) is 3 and mrate is None):
     337                     errormess("3D field in input but not rate specified for movie (use --rate RATE or specify --time TIME). Exit.")
     338                 istart=0
     339                 if mrate is not None: iend=len(time)-1
     340                 else:                 iend=istart
    344341                 imov=istart
    345 
    346342                 while imov <= iend:
    347                     what_I_plot_frame=what_I_plot
    348                     if mrate is not None:
    349                        what_I_plot_frame=what_I_plot[imov,:,:]
    350                        print "-> frame ",imov+1
    351                     if hole: what_I_plot_frame = hole_bounds(what_I_plot_frame,zevmin,zevmax)
    352                     else: what_I_plot_frame = bounds(what_I_plot_frame,zevmin,zevmax)
    353                     if flagnolow: what_I_plot_frame = nolow(what_I_plot_frame)
     343                    what_I_plot_frame = what_I_plot
     344                    if mrate is not None:      what_I_plot_frame = what_I_plot[imov,:,:] ; print "-> frame ",imov+1
     345                    if hole:                   what_I_plot_frame = hole_bounds(what_I_plot_frame,zevmin,zevmax)
     346                    else:                      what_I_plot_frame = bounds(what_I_plot_frame,zevmin,zevmax)
     347                    if flagnolow:              what_I_plot_frame = nolow(what_I_plot_frame)
    354348                    if not tile:
    355349                        #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20)
    356350                        zelevels = np.linspace(zevmin,zevmax,num=ticks)
    357                         if imov is 0:
    358                            print np.array(x).shape
    359                            print np.array(y).shape
    360                            print np.array(what_I_plot_frame).shape
    361    
     351                        if imov is 0:          print np.array(x).shape, np.array(y).shape, np.array(what_I_plot_frame).shape
    362352                        if mapmode == 1:       m.contourf( x, y, what_I_plot_frame, zelevels, cmap = palette)
    363353                        elif mapmode == 0:     contourf( x, y, what_I_plot_frame, zelevels, cmap = palette)
     
    374364                        #mframe=fig2data(mpl.pyplot.gcf())
    375365                        mframe=fig2img(mpl.pyplot.gcf())
    376 
    377                         if ((mrate is not None) and (imov is 0)):
    378                             W,H = mpl.pyplot.gcf().canvas.get_width_height()
    379                             video = VideoSink((H,W), "test", rate=mrate, byteorder="rgba")
    380                         if mrate is not None:
    381                             video.run(mframe)
    382                             mpl.pyplot.close()
    383 
    384                         imov=imov+1
     366                    if ((mrate is not None) and (imov is 0)):
     367                        W,H = mpl.pyplot.gcf().canvas.get_width_height()
     368                        video = VideoSink((H,W), "test", rate=mrate, byteorder="rgba")
     369                    if mrate is not None:
     370                        video.run(mframe)
     371                        mpl.pyplot.close()
     372                    imov=imov+1
    385373                 if mrate is not None: video.close
    386374               ##### 1D field
Note: See TracChangeset for help on using the changeset viewer.