Ignore:
Timestamp:
Jul 19, 2013, 10:35:53 AM (11 years ago)
Author:
aslmd
Message:

UTIL PYTHON. various updates on example + mcd + plot scripts. nothing major.

Location:
trunk/UTIL/PYTHON/planetoplot_v2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/planetoplot_v2/ppcompute.py

    r1002 r1007  
    9595           else:
    9696              return np.array(field).sum(axis=axis)
     97
     98## compute mean over bins
     99## author AS
     100def meanbin(y,x,bins):
     101    bins.sort() # sorting is needed for binning
     102    meanvalues = []
     103    for iii in range(len(bins)):
     104        ## GET VALUES OVER RELEVANT INTERVALS
     105        if iii == 0:
     106          ind = x<bins[iii+1] ; ys = y[ind]
     107        elif iii == len(bins)-1:
     108          ind = x>=bins[iii-1] ; ys = y[ind]
     109        else:
     110          ind = x>=bins[iii-1] ; interm = x[ind] ; intermf = y[ind]
     111          ind = interm<bins[iii+1] ; xs = interm[ind] ; ys = intermf[ind]
     112        ## COMPUTE MEAN and TREAT NAN CASE
     113        meanvalues.append(mean(ys))
     114    ## RETURN A NUMPY ARRAY
     115    meanvalues = np.array(meanvalues)
     116    return meanvalues
    97117
    98118################
  • trunk/UTIL/PYTHON/planetoplot_v2/ppplot.py

    r1004 r1007  
    180180# useful functions #
    181181####################
     182
     183# continuity with matplotlib
     184def close():
     185    mpl.close()
     186
     187# a function for predefined figure sizes
     188def figuref(x=16,y=9):
     189    mpl.figure(figsize=(x,y))
    182190
    183191# a function to change color lines according to a color map (idea by A. Pottier)
     
    649657                objC = mpl.contour(x, y, what_I_contour, \
    650658                            zelevelsc, colors = ccol, linewidths = cline)
    651                 #mpl.clabel(objC, inline=1, fontsize=10)
     659                #mpl.clabel(objC, inline=1, fontsize="small",\
     660                #             inline_spacing=1,fmt="%.0f")
    652661            mpl.contourf(x, y, \
    653662                         self.field, \
    654663                         zelevels, cmap=palette)
     664            #mpl.pcolor(x,y,\
     665            #             self.field, \
     666            #             cmap=palette)
    655667            # make log axes and/or invert ordinate
    656668            ax = mpl.gca()
Note: See TracChangeset for help on using the changeset viewer.