Changeset 578 for trunk


Ignore:
Timestamp:
Mar 13, 2012, 12:16:26 PM (13 years ago)
Author:
acolaitis
Message:

PYTHON. --title works now with multiple titles in a list (same as --labels.). Bug correction with sslon and sslat.

Location:
trunk/UTIL/PYTHON
Files:
3 edited

Legend:

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

    r572 r578  
    8080    # missing values from zrecast or hrecast are -1e-33
    8181       masked=np.ma.masked_where(field < -1e30,field)
    82        masked.set_fill_value([np.NaN])
    83        mask = np.ma.getmask(masked)
    84        if (True in np.array(mask)):out=masked
    85        else:
    86        # missing values from api are 1e36
    87           masked=np.ma.masked_where(field > 1e35,field)
    88           masked.set_fill_value([np.NaN])
    89           mask = np.ma.getmask(masked)
    90           if (True in np.array(mask)):out=masked
    91           else:out=field
     82       masked2=np.ma.masked_where(field > 1e35,field)
     83       masked.set_fill_value([np.NaN]) ; masked2.set_fill_value([np.NaN])
     84       mask = np.ma.getmask(masked) ; mask2 = np.ma.getmask(masked2)
     85       if (True in np.array(mask)):
     86          out=masked
     87          print "Masked array... Missing value is NaN"
     88       elif (True in np.array(mask2)):
     89          out=masked2
     90          print "Masked array... Missing value is NaN"
     91#       else:
     92#       # missing values from api are 1e36
     93#          masked=np.ma.masked_where(field > 1e35,field)
     94#          masked.set_fill_value([np.NaN])
     95#          mask = np.ma.getmask(masked)
     96#          if (True in np.array(mask)):out=masked
     97#          else:out=field
     98       else:out=field
    9299    return out
    93100
  • trunk/UTIL/PYTHON/planetoplot.py

    r571 r578  
    3333           ndiv=10,\
    3434           mult=1.,\
    35            zetitle="fill",\
     35           zetitle=["fill"],\
    3636           slon=None,\
    3737           slat=None,\
     
    9999    ### Which plot needs to be done?
    100100    ################################
     101    sslon = None ; sslat = None
    101102    nlon, nlat, nvert, ntime, mapmode, nslices = determineplot(slon, slat, svert, stime)
    102103    if mrate is not None and len(var) > 1: errormess("multivar not allowed in movies. should be fixed soon!")
     
    196197          ###### STUFF TO GET THE CORRECT LAT/LON FROM MESOSCALE FILES WITH 2D LAT/LON ARRAYS
    197198          ###### principle: calculate correct indices then repopulate slon and slat
    198           sslon = None ; sslat = None
    199199          if slon is not None or slat is not None:
    200200              if slon is not None: sslon = np.zeros([1,2])
     
    521521                            zecb = colorbar( fraction=0.05,pad=0.03,format=daformat,orientation=zeorientation,\
    522522                                      ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])),extend='neither',spacing='proportional' )
    523                             if zeorientation == "horizontal" and zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle=""
     523                            if zeorientation == "horizontal" and zetitle[0] != "fill": zecb.ax.set_xlabel(zetitle[index_f]) ; zetitle[index_f]=""
    524524                        if winds:
    525525                            if typefile in ['meso']:
     
    542542                            what_I_plot_frame, x, y = define_axis( lon,lat,vert,time,indexlon,indexlat,indexvert,\
    543543                                                              itime,what_I_plot_frame, len(all_var2[index_f].shape),vertmode )
    544                             cs = contour( x,y,what_I_plot_frame, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)
    545                         elif mapmode == 1:  cs = m.contour( x,y,what_I_plot_frame, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)
    546 
     544                            cs = contour( x,y,what_I_plot_frame, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)#, linestyles='solid')
     545                        elif mapmode == 1:  cs = m.contour( x,y,what_I_plot_frame, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)# , linestyles='solid')
    547546                    if which in ["regular","unidim"]:
    548547
     
    610609            else:                            plottitle = basename+' '+namefiles[0]#index_f]
    611610       if mult != 1:                         plottitle = '{:.0e}'.format(mult) + "*" + plottitle
    612        if zetitle != "fill":                 
    613           plottitle = zetitle
    614           if titleref is "fill":             titleref=zetitle
     611       if zetitle[0] != "fill":                 
     612          plottitle = zetitle[index_f]
     613          if titleref is "fill":             titleref=zetitle[index_f]
    615614          if fileref is not None:
    616615             if index_f is numplot-2:        plottitle = titleref
     
    628627        zecb = colorbar(cax=cax, orientation="horizontal", format=fmtvar(fvar.upper()),\
    629628                 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,21])),extend='neither',spacing='proportional')
    630         if zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle=""
     629        if zetitle[0] != "fill": zecb.ax.set_xlabel(zetitle[index_f]) ; zetitle[index_f]=""
    631630
    632631     
  • trunk/UTIL/PYTHON/pp.py

    r569 r578  
    157157                hole=opt.hole,save=opt.save,\
    158158                anomaly=opt.anomaly,var2=opt.var2,ndiv=opt.ndiv,\
    159                 mult=opt.mult,zetitle=opt.zetitle,\
     159                mult=opt.mult,zetitle=separatenames(opt.zetitle),\
    160160                slon=zeslon,slat=zeslat,svert=zesvert,stime=zestime,\
    161161                outputname=opt.out,resolution=opt.res,\
Note: See TracChangeset for help on using the changeset viewer.