Ignore:
Timestamp:
Jan 24, 2013, 1:05:12 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON. Improved redope (also available now with contours). Added --add (same as --mult for an addition). Added colormaps. Tried a different way to put wind vector reference (above colorbar).

File:
1 edited

Legend:

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

    r864 r865  
    3838           ndiv=10,\
    3939           mult=1.,\
     40           add=0.,\
    4041           zetitle=["fill"],\
    4142           slon=None,\
     
    9697                                  subplots_adjust, axes, clabel
    9798    from matplotlib.cm import get_cmap
    98     #from mpl_toolkits.basemap import cm
     99    from mpl_toolkits.basemap import cm
    99100    import numpy as np
    100101    from numpy.core.defchararray import find
     
    107108    import os
    108109    from scipy import ndimage
     110
    109111
    110112#########################
     
    126128    if clb is None:            clb = ["def"]*len(var)
    127129    elif len(clb) < len(var):  clb = [clb[0]]*len(var) ; print "WARNING: less color than vars! setting all to 1st value."
     130    if redope is not None and winds: winds=False ; print "WARNING: no winds with redope. setting winds to False."
    128131### we set option trycol i.e. the user wants to try a set of colorbars
    129132    if trycol: clb = ["Greys","Blues","YlOrRd","jet","spectral","hot","RdBu","RdYlBu","Paired"] ; zetitle = clb ; var = [var[0]]*9
     
    501504           what_I_plot, error = reducefield( all_var[index_f], d4=indextime, d1=indexlon, d2=indexlat, d3=indexvert, \
    502505                                             yint=yintegral, alt=vert, anomaly=anomaly, redope=redope, mesharea=area, unidim=is1d)
     506           if add != 0.:      what_I_plot = what_I_plot + add
    503507           if mult != 2718.:  what_I_plot = what_I_plot*mult
    504508           else:              what_I_plot = np.log10(what_I_plot) ; print "log plot"
    505                  
     509
    506510       if var2:      ### what is contoured.
    507511           what_I_plot_contour, error = reducefield( all_var2[index_f], d4=indextime, d1=indexlon, d2=indexlat , d3=indexvert, \
    508                                                      yint=yintegral, alt=vert )
     512                                                     yint=yintegral, alt=vert, redope=redope )
    509513       if winds:     ### what is plot as vectors.
    510514           vecx, error = reducefield( all_windu[index_f], d4=indextime, d3=indexvert, yint=yintegral, alt=vert)
     
    569573               #if (fileref is not None) and (index_f == numplot-1):    colorb = "RdBu_r"
    570574               if colorb in ["def","nobar","onebar"]:                  palette = get_cmap(name=defcolorb(fvar.upper()))
     575               elif colorb == "relief":                                palette = cm.GMT_relief
     576               elif colorb == "haxby":                                 palette = cm.GMT_haxby
    571577               else:                                                   palette = get_cmap(name=colorb)
    572578               #palette = cm.GMT_split
     
    794800                           
    795801                    elif which == "contour":
     802                        rcParams['contour.negative_linestyle'] = 'solid' # no dashed line for negative values
    796803                        zevminc, zevmaxc = calculate_bounds(what_I_plot_frame, vmin=min(what_I_plot_frame), vmax=max(what_I_plot_frame))
    797804                        zelevels = np.linspace(zevminc,zevmaxc,ticks/2) #20)
    798805                        ### another dirty specific stuff in the wall
    799                         if var2 == 'HGT':        zelevels = np.arange(-10000.,30000.,500.) #1000.)
     806                        if var2 == 'HGT':        zelevels = np.arange(-10000.,30000.,250.) #1000.)
    800807                        elif var2 == 'tpot':     zelevels = np.arange(270,370,5)
    801808                        elif var2 == 'tk':       zelevels = np.arange(150,250,5)
Note: See TracChangeset for help on using the changeset viewer.