Changeset 363


Ignore:
Timestamp:
Nov 9, 2011, 3:28:13 PM (13 years ago)
Author:
acolaitis
Message:

M 362 planetoplot.py
M 362 meso.py
M 362 gcm.py
----------------- Added --inverty option to force pyplot to inverse the y axis of a contourplot. Usefull when plotting data along pressure vertical axis.

M 362 zrecast_wrapper.py
----------------- Some modif for the pressure interpolation. A following commit will make it cleaner so that interpolation details can be passed to zrecast from gcm.py

M 362 myplot.py
----------------- Minor modifs, added some variables.

Location:
trunk/UTIL/PYTHON
Files:
5 edited

Legend:

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

    r362 r363  
    5656    parser.add_option('--Mope',         action='store',dest='vmaxope', type="float",   default=0.,  help='bounding maximum value for inter-file operation')
    5757    parser.add_option('--titleref',     action='store',dest='titref',  type="string",  default="fill",  help='title for the reference file. Default: title of figure (1)')
     58    parser.add_option('--inverty',      action='store_true',dest='inverty',             default=False, help='Force matplotlib.pyplot to revert the y-axis. Can be of use when plotting data along pressure levels. (pyplot naturally tend to plot the z-axis with increasing values)')
     59   
    5860
    5961    ############# T.N. changes
     
    211213                slon=zeslon,slat=zeslat,svert=zesvert,stime=zestime,\
    212214                outputname=opt.output,resolution=opt.res,\
    213                 ope=opt.operation,fileref=reffile,minop=opt.vminope,maxop=opt.vmaxope,titleref=opt.titref)
     215                ope=opt.operation,fileref=reffile,minop=opt.vminope,maxop=opt.vmaxope,titleref=opt.titref,\
     216                invert_y=opt.inverty)
    214217        print 'Done: '+name
    215218        system("rm -f to_be_erased")
  • trunk/UTIL/PYTHON/meso.py

    r359 r363  
    4545    parser.add_option('--mult',         action='store',dest='mult',      type="float",   default=1.,    help='a multiplicative factor to plotted field')
    4646    parser.add_option('--title',        action='store',dest='zetitle',   type="string",  default="fill",help='customize the whole title')
     47    parser.add_option('--inverty',      action='store_true',dest='inverty',             default=False, help='Force matplotlib.pyplot to revert the y-axis. Can be of use when plotting data along pressure levels. (pyplot naturally tend to plot the z-axis with increasing values)')
    4748    #parser.add_option('-V', action='store', dest='comb',        type="float",   default=None,  help='a defined combination of variables')
    4849
     
    156157                mult=opt.mult,zetitle=opt.zetitle,\
    157158                slon=zeslon,slat=zeslat,svert=zesvert,stime=zestime,\
    158                 outputname=opt.output,resolution=opt.res)
     159                outputname=opt.output,resolution=opt.res,invert_y=opt.inverty)
    159160        print 'Done: '+name
    160161        system("rm -f to_be_erased")
  • trunk/UTIL/PYTHON/myplot.py

    r359 r363  
    558558    fmtvar    =     { \
    559559             "tk":           "%.0f",\
     560             "T_NADIR_DAY":  "%.0f",\
     561             "T_nadir_nit":  "%.0f",\
     562             "T_nadir_day":  "%.0f",\
    560563             "tpot":         "%.0f",\
    561564             "TSURF":        "%.0f",\
     
    599602             "QH2O":         "PuBu",\
    600603             "USTM":         "YlOrRd",\
     604             #"T_nadir_nit":  "RdBu_r",\
     605             #"T_nadir_day":  "RdBu_r",\
    601606             "HFX":          "RdYlBu",\
    602607             "ICETOT":       "YlGnBu_r",\
  • trunk/UTIL/PYTHON/planetoplot.py

    r361 r363  
    4444           minop=0.,\
    4545           maxop=0.,\
    46            titleref="fill"):
     46           titleref="fill",\
     47           invert_y=False):
    4748
    4849
     
    5859                       getname,localtime,polarinterv,getsindex,define_axis,determineplot
    5960    from mymath import deg,max,min,mean
     61    import matplotlib as mpl
    6062    from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show, plot, clabel
    6163    from matplotlib.cm import get_cmap
     
    112114          lat = nc.variables["latitude"][:]
    113115          lon = nc.variables["longitude"][:]
    114           time = nc.variables["Time"][:]
     116          time = nc.variables["time"][:]
     117#          if errorTime is True:
     118#             time = nc.variables["time"][:]
    115119          vert = nc.variables["altitude"][:]
    116120      elif typefile in ['meso','mesoapi']:
     
    276280           what_I_plot, error = reducefield(all_var[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert )
    277281           what_I_plot = what_I_plot*mult
    278 
    279282           if not error:
    280283               fvar = var
     
    304307                     zelevels = np.linspace(zevmin,zevmax)#,num=ndiv+1)
    305308                     #contourf(what_I_plot, zelevels, cmap = palette )
     309
    306310                     contourf( x, y, what_I_plot, zelevels, cmap = palette )
     311                     if invert_y:
     312                        lima,limb = mpl.pyplot.ylim()
     313                        mpl.pyplot.ylim(limb,lima)
     314
    307315                 else:
    308316                     if hole:  what_I_plot = nolow(what_I_plot)
  • trunk/UTIL/PYTHON/zrecast_wrapper.py

    r361 r363  
    2020        system("echo >> zrecast.auto.def")
    2121        if interp_mode == 4:
     22             append="_S"
    2223             system("echo 3 >> zrecast.auto.def")
    2324             system("echo yes >> zrecast.auto.def")
    2425             system("echo 0 150000 >> zrecast.auto.def")
    2526        elif interp_mode == 2:
     27             append="_P"
    2628             system("echo 1 >> zrecast.auto.def")
    2729             system("echo yes >> zrecast.auto.def")
    2830             system("echo 0.0001 6. >> zrecast.auto.def")  #I put that randomly! (a.c.)
     31             system("echo 32 >> zrecast.auto.def")
    2932        else:
    3033             print "zrecast interp option unsupported for now. Exiting."
    3134             exit()
    3235        system("zrecast.e < zrecast.auto.def")
     36
    3337        if indicefile is 0:
    34               outputfilename=input_name[indicefile][0:len(input_name[0])-3]+"_S.nc"
     38              outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
    3539        else:
    36               outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+"_S.nc"
     40              outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
    3741        indicefile = indicefile +1
    3842
Note: See TracChangeset for help on using the changeset viewer.