Ignore:
Timestamp:
Oct 25, 2012, 11:24:38 PM (12 years ago)
Author:
aslmd
Message:

UTIL PYTHON : improved projections. improved local time ticks. small bug fix with vertical coordinates. added a keyword nocolorb.

File:
1 edited

Legend:

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

    r796 r817  
    6565def check_localtime(time):
    6666    a=-1
    67     print time
    6867    for i in range(len(time)-1):
    6968       if (time[i] > time[i+1]): a=i
     
    452451
    453452## Author: AS + TN
    454 def definesubplot ( numplot, fig ):
     453def definesubplot ( numplot, fig, ipreferline=False):
    455454    from matplotlib.pyplot import rcParams
    456455    rcParams['font.size'] = 12. ## default (important for multiple calls)
     
    470469        subh = 1
    471470        fig.subplots_adjust(hspace = 0.5)
     471        if ipreferline: subv = 1 ; subh = 3 ; fig.subplots_adjust(wspace = 0.35)
    472472        rcParams['font.size'] = int( rcParams['font.size'] * 1. / 2. )
    473473    elif numplot == 4:
     
    883883    h = 50.  ## en km
    884884    radius = 3397200.
    885     #print meanlat, meanlon
    886885    if   char == "cyl":     m = Basemap(rsphere=radius,projection='cyl',\
    887886                              llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
     
    900899    elif char == "merc":    m = Basemap(rsphere=radius,projection='merc',lat_ts=0.,\
    901900                              llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
     901    elif char == "geos":    m = Basemap(rsphere=radius,projection='geos',lon_0=meanlon)
     902    elif char == "robin":   m = Basemap(rsphere=radius,projection='robin',lon_0=0)
     903    elif char == "cass":   
     904             if zewidth > 60000.:  ## approx. more than one degree
     905                m = Basemap(rsphere=radius,projection='cass',\
     906                              lon_0=meanlon,lat_0=meanlat,\
     907                              width=zewidth,height=zeheight)
     908             else:
     909                m = Basemap(rsphere=radius,projection='cass',\
     910                              lon_0=meanlon,lat_0=meanlat,\
     911                              llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
     912    else:                   errormess("projection not supported.")
    902913    fontsizemer = int(mpl.rcParams['font.size']*3./4.)
    903     if char in ["cyl","lcc","merc","nsper","laea"]:   step = findstep(wlon)
    904     else:                                             step = 10.
    905     steplon = step*2.
     914    if zewidth > 60000.:
     915        if char in ["cyl","lcc","merc","nsper","laea"]:   step = findstep(wlon)
     916        else:                                             step = 10.
     917        steplon = step*2.
     918    else:
     919        print "very small domain !"
     920        steplon = 0.5
     921        step = 0.5
    906922    zecolor ='grey'
    907923    zelinewidth = 1
    908     zelatmax = 80
    909     if meanlat > 75.: zelatmax = 90. ; step = step/2.
     924    zelatmax = 80.
     925    if meanlat > 75.:  zelatmax = 90. ; step = step/2. ; steplon = steplon*2.
    910926    # to show gcm grid:
    911927    #zecolor = 'r'
     
    914930    #steplon = 360./64.
    915931    #zelatmax = 90. - step/3
    916     if char not in ["moll"]:
     932    if char not in ["moll","robin"]:
    917933        if wlon[1]-wlon[0] < 2.:  ## LOCAL MODE
    918934            m.drawmeridians(np.r_[-1.:1.:0.05], labels=[0,0,0,1], color=zecolor, linewidth=zelinewidth, fontsize=fontsizemer, fmt='%5.2f')
     
    10411057             "TPOT":         "%.0f",\
    10421058             "TSURF":        "%.0f",\
     1059             "TSK":          "%.0f",\
    10431060             "U_OUT1":       "%.0f",\
    10441061             "T_OUT1":       "%.0f",\
     
    10921109             "TPOT":         "Paired",\
    10931110             "TSURF":        "RdBu_r",\
     1111             "TSK":          "RdBu_r",\
    10941112             "QH2O":         "PuBu",\
    10951113             "USTM":         "YlOrRd",\
     
    13501368      else: y = lat
    13511369      count = count+1
    1352    if indexvert is None and ((dim0 == 4) or (y is None)):
     1370   if indexvert is None and len(vert) > 1 and ((dim0 == 4) or (y is None)):
    13531371      print "AXIS is vert"
    13541372      if vertmode == 0: # vertical axis is as is (GCM grid)
Note: See TracChangeset for help on using the changeset viewer.