Ignore:
Timestamp:
Jul 23, 2011, 1:38:02 AM (14 years ago)
Author:
aslmd
Message:

MESOSCALE: python graphics: contour plots + various small but convenient improvements. fixed broken domain.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/myplot.py

    r240 r241  
    7171    return output, error
    7272
    73 def latinterv (area):
    74         if   area == "Europe":
    75                 wlat = [20.,80.]
    76                 wlon = [-50.,50.]
    77         elif area == "Central_America":
    78                 wlat = [-10.,40.]
    79                 wlon = [230.,300.]
    80         elif area == "Africa":
    81                 wlat = [-20.,50.]
    82                 wlon = [-50.,50.]
    83         elif area == "Whole":
    84                 wlat = [-90.,90.]
    85                 wlon = [-180.,180.]
    86         elif area == "Southern_Hemisphere":
    87                 wlat = [-90.,60.]
    88                 wlon = [-180.,180.]
    89         elif area == "Northern_Hemisphere":
    90                 wlat = [-60.,90.]
    91                 wlon = [-180.,180.]
    92         elif area == "Tharsis":
    93                 wlat = [-30.,60.]
    94                 wlon = [-170.,-10.]
    95         elif area == "Whole_No_High":
    96                 wlat = [-60.,60.]
    97                 wlon = [-180.,180.]
    98         elif area == "Chryse":
    99                 wlat = [-60.,60.]
    100                 wlon = [-60.,60.]
    101         elif area == "North_Pole":
    102                 wlat = [50.,90.]
    103                 wlon = [-180.,180.]
    104         elif area == "Close_North_Pole":
    105                 wlat = [75.,90.]
    106                 wlon = [-180.,180.]
    107         elif area == "South_Pole":
    108                 wlat = [-90.,-50.]
    109                 wlon = [-180.,180.]
    110         elif area == "Close_South_Pole":
    111                 wlat = [-90.,-75.]
    112                 wlon = [-180.,180.]
    113         return wlon,wlat
     73#def latinterv (area):
     74#       if   area == "Europe":                [wlat,wlon] = [[ 20., 80.],[- 50.,  50.]]
     75#       elif area == "Central_America":       [wlat,wlon] = [[-10., 40.],[ 230., 300.]]
     76#       elif area == "Africa":                [wlat,wlon] = [[-20., 50.],[- 50.,  50.]]
     77#       elif area == "Whole":                 [wlat,wlon] = [[-90., 90.],[-180.,-180.]]
     78#       elif area == "Southern_Hemisphere":   [wlat,wlon] = [[-90., 60.],[-180.,-180.]]
     79#        elif area == "Northern_Hemisphere":   [wlat,wlon] = [[-60., 90.],[-180.,-180.]]
     80#        elif area == "Tharsis":               [wlat,wlon] = [[-30., 60.],[-170.,- 10.]]
     81#       elif area == "Whole_No_High":         [wlat,wlon] = [[-60., 60.],[-180., 180.]]
     82#       elif area == "Chryse":                [wlat,wlon] = [[-60., 60.],[- 60.,  60.]]
     83#        elif area == "North_Pole":            [wlat,wlon] = [[ 50., 90.],[-180., 180.]]
     84#        elif area == "Close_North_Pole":      [wlat,wlon] = [[ 75., 90.],[-180., 180.]]
     85#        elif area == "Far_South_Pole":        [wlat,wlon] = [[-90.,-40.],[-180., 180.]]
     86#        elif area == "South_Pole":            [wlat,wlon] = [[-90.,-50.],[-180., 180.]]
     87#        elif area == "Close_South_Pole":      [wlat,wlon] = [[-90.,-75.],[-180., 180.]]
     88#       return wlon,wlat
    11489
    11590def definesubplot ( numplot, fig ):
     
    142117    elif numplot == 1:
    143118        sub = 99999
    144     elif numplot < 0:
     119    elif numplot <= 0:
    145120        sub = 99999
    146121    else:
     
    182157        zeday = int(zetime[8]+zetime[9]) - int(zetimestart[8]+zetimestart[9])
    183158        if zeday < 0:    lschar=""  ## might have crossed a month... fix soon
    184         else:            lschar="_Ls"+str( int( sol2ls ( getattr( nc, 'JULDAY' ) + zeday ) ) )
     159        else:            lschar="_Ls"+str( int( 10. * sol2ls ( getattr( nc, 'JULDAY' ) + zeday ) ) / 10. )
    185160        ###
    186161        zetime2 = nc.variables['Times'][1]
     
    472447    return what_I_plot
    473448
     449def nolow(what_I_plot):
     450    from mymath import max,min
     451    lim = 0.15*0.5*(abs(max(what_I_plot))+abs(min(what_I_plot)))
     452    print "on vire en dessous de ", lim
     453    what_I_plot [ abs(what_I_plot) < lim ] = 1.e40
     454    return what_I_plot
     455
    474456def zoomset (wlon,wlat,zoom):
    475457    dlon = abs(wlon[1]-wlon[0])/2.
     
    492474             "TAU_ICE":      "%.2f",\
    493475             "anomaly":      "%.1f",\
     476             "W":            "%.1f",\
    494477                    }
    495478    if whichvar not in fmtvar:
     
    509492             "ICETOT":       "YlGnBu",\
    510493             "TAU_ICE":      "Blues",\
     494             "W":            "jet",\
    511495             "anomaly":      "RdBu_r",\
    512496                     }
     497#W --> spectral ou jet
    513498#spectral BrBG RdBu_r
     499    print "predefined colorbars"
    514500    if whichone not in whichcolorb:
    515501        whichone = "def"
     
    567553        return whichlink
    568554
     555def latinterv (area="Whole"):
     556    list =    { \
     557        "Europe":                [[ 20., 80.],[- 50.,  50.]],\
     558        "Central_America":       [[-10., 40.],[ 230., 300.]],\
     559        "Africa":                [[-20., 50.],[- 50.,  50.]],\
     560        "Whole":                 [[-90., 90.],[-180.,-180.]],\
     561        "Southern_Hemisphere":   [[-90., 60.],[-180.,-180.]],\
     562        "Northern_Hemisphere":   [[-60., 90.],[-180.,-180.]],\
     563        "Tharsis":               [[-30., 60.],[-170.,- 10.]],\
     564        "Whole_No_High":         [[-60., 60.],[-180., 180.]],\
     565        "Chryse":                [[-60., 60.],[- 60.,  60.]],\
     566        "North_Pole":            [[ 50., 90.],[-180., 180.]],\
     567        "Close_North_Pole":      [[ 75., 90.],[-180., 180.]],\
     568        "Far_South_Pole":        [[-90.,-40.],[-180., 180.]],\
     569        "South_Pole":            [[-90.,-50.],[-180., 180.]],\
     570        "Close_South_Pole":      [[-90.,-75.],[-180., 180.]],\
     571              }
     572    if area not in list:   area = "Whole"
     573    [olat,olon] = list[area]
     574    return olon,olat
     575
Note: See TracChangeset for help on using the changeset viewer.