Changeset 439 for trunk/UTIL


Ignore:
Timestamp:
Dec 1, 2011, 10:51:35 AM (13 years ago)
Author:
acolaitis
Message:

PYTHON. Added a function call_contour in myplot, which replace the part of planetplot devoted to contour plot. It is the same code, but it makes the main file less messy, and now call_contour can be coded in the movie part.

File:
1 edited

Legend:

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

    r438 r439  
    6464                       fmtvar,definecolorvec,defcolorb,getprefix,putpoints,calculate_bounds,errormess,definesubplot,\
    6565                       zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow,\
    66                        getname,localtime,polarinterv,getsindex,define_axis,determineplot,readslices,bidimfind,getlschar,hole_bounds
     66                       getname,localtime,polarinterv,getsindex,define_axis,determineplot,readslices,bidimfind,getlschar,hole_bounds,\
     67                       call_contour
    6768    from mymath import deg,max,min,mean,get_tsat,writeascii,fig2data,fig2img
    6869    import matplotlib as mpl
     
    279280       #### Contour plot -- to be activated with movies
    280281       if var2 and mrate is None:
    281            what_I_plot, error = reducefield(all_var2[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert, yint=yintegral, alt=vert)
    282            #what_I_plot = what_I_plot*mult
    283            if not error:
    284               if mapmode == 1:
    285                   if typefile in ['mesoapi','meso']:    what_I_plot = dumpbdy(what_I_plot,6)
    286               zevmin, zevmax = calculate_bounds(what_I_plot)
    287               zelevels = np.linspace(zevmin,zevmax,ticks) #20)
    288               if var2 == 'HGT':  zelevels = np.arange(-10000.,30000.,2000.)
    289               if mapmode == 0:
    290                   #if typefile in ['mesoideal']:    what_I_plot = dumpbdy(what_I_plot,0,stag='W')
    291                   itime=indextime
    292                   if len(what_I_plot.shape) is 3: itime=[0]
    293                   what_I_plot, x, y = define_axis(lon,lat,vert,time,indexlon,indexlat,indexvert,\
    294                         itime,what_I_plot, len(all_var2[index_f].shape),vertmode)
    295               ### If we plot a 2-D field
    296               if len(what_I_plot.shape) is 2:
    297                   #zelevels=[0.2,0.4,0.6,0.8,1.]
    298                   cs = contour(x,y,what_I_plot, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)
    299                   #clabel(cs,zelevels,inline=3,fmt='%1.1f',fontsize=7)
    300               ### If we plot a 1-D field
    301               elif len(what_I_plot.shape) is 1:
    302                   plot(what_I_plot,x)
    303            else:
    304               errormess("There is an error in reducing field !")
     282           call_contour(lon,lat,vert,time,vertmode,all_var2[index_f],indextime,indexlon,indexlat,indexvert,yintegral,mapmode,typefile, var2, ticks)
    305283
    306284       #### Shaded plot
     
    360338                       if invert_y:     lima,limb = mpl.pyplot.ylim() ; mpl.pyplot.ylim(limb,lima)
    361339                       if ylog:         mpl.pyplot.semilogy()
    362 
    363 
     340                   
    364341                    if not tile:
    365342                        #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20)
Note: See TracChangeset for help on using the changeset viewer.