Ignore:
Timestamp:
Jan 23, 2012, 5:04:36 PM (13 years ago)
Author:
acolaitis
Message:

Python. Minor corrections to several subroutines. Added possibility to label manually x and y axis. (use --xlabel and --ylabel). Corrected make_netcdf for certain tricky cases. Modified mcs.py to be complied with recent modifs in hrecast and zrecast. Treated cases with division by 0 in operation -%.

File:
1 edited

Legend:

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

    r494 r502  
    5959           zarea=None,\
    6060           axtime=None,\
    61            redope=None):
     61           redope=None,\
     62           xlab=None,\
     63           ylab=None):
    6264
    6365
     
    7476    from mymath import deg,max,min,mean,get_tsat,writeascii,fig2data,fig2img
    7577    import matplotlib as mpl
    76     from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend, xlabel, axis
     78    from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel, title, close, legend, xlabel, axis, ylabel
    7779    from matplotlib.cm import get_cmap
    7880    #from mpl_toolkits.basemap import cm
     
    265267                if ope == "-":     all_var[k+1]= all_var[k-1] - all_var[k]
    266268                elif ope == "+":   all_var[k+1]= all_var[k-1] + all_var[k]
    267                 elif ope == "-%":  all_var[k+1]= 100.*(all_var[k-1] + all_var[k])/all_var[k]
     269                elif ope == "-%":
     270                    masked = np.ma.masked_where(all_var[k] == 0,all_var[k])
     271                    masked.set_fill_value([np.NaN])
     272                    all_var[k+1]= 100.*(all_var[k-1] - masked)/masked
    268273                all_varname[k+1] = all_varname[k] ; all_time[k+1] = all_time[k] ; all_namefile[k+1] = all_namefile[k] ; numplot = numplot+2
    269274             elif ope in ["cat"]:
     
    440445                        else:                                             plot(what_I_plot_frame,x,label=lbl)  ## vertical profile
    441446                        if nplot > 1: legend(loc='best')
    442                         if indextime is None and axtime is not None    xlabel(axtime.upper()) ## define the right label
     447                        if indextime is None and axtime is not None and xlab is None:    xlabel(axtime.upper()) ## define the right label
    443448                        if save == 'txt':  writeascii(np.transpose(what_I_plot),'profile'+str(nplot*1000+imov)+'.txt')
    444449
     
    498503                           if ylog:      mpl.pyplot.semilogy()
    499504                           if invert_y:  ax = mpl.pyplot.gca() ; ax.set_ylim(ax.get_ylim()[::-1])
     505                           if xlab is not None: xlabel(xlab)
     506                           if ylab is not None: ylabel(ylab)
    500507
    501508                        if mrate is not None:
Note: See TracChangeset for help on using the changeset viewer.