Ignore:
Timestamp:
Aug 2, 2011, 1:48:14 AM (13 years ago)
Author:
aslmd
Message:

MESOSCALE: oops. forgot a file in the previous commit. all apologies.

File:
1 edited

Legend:

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

    r247 r252  
    1 def errormess(text):
     1def errormess(text,printvar=None):
    22    print text
     3    if printvar: print printvar
    34    exit()
    45    return
     6
     7def getname(var=False,winds=False,anomaly=False):
     8    if var and winds:     basename = var + '_UV'
     9    elif var:             basename = var
     10    elif winds:           basename = 'UV'
     11    else:                 errormess("please set at least winds or var",printvar=nc.variables)
     12    if anomaly:           basename = 'd' + basename
     13    return basename
     14
     15def localtime(utc,lon):
     16    ltst = utc + lon / 15.
     17    ltst = int (ltst * 10) / 10.
     18    ltst = ltst % 24
     19    return ltst
    520
    621def whatkindfile (nc):
     
    2136
    2237def reducefield (input,d4=None,d3=None,d2=None,d1=None):
    23     ### do it the reverse way to be compliant with netcdf "t z y x" or "t y x" or "y x"
     38    ### we do it the reverse way to be compliant with netcdf "t z y x" or "t y x" or "y x"
    2439    ### it would be actually better to name d4 d3 d2 d1 as t z y x
    2540    import numpy as np
     
    7186    return output, error
    7287
    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
    89 
    9088def definesubplot ( numplot, fig ):
    9189    from matplotlib.pyplot import rcParams
     
    197195        else:
    198196            proj="merc"
    199     elif typefile in ['gcm']:  proj="cyl"  ## pb avec les autres (de trace derriere la sphere ?)
     197    elif typefile in ['gcm']:  proj="cyl"    ## pb avec les autres (de trace derriere la sphere ?)
    200198    else:                      proj="ortho"
    201199    return proj   
     
    205203    title(name)
    206204    print name
     205
     206def polarinterv (lon2d,lat2d):
     207    import numpy as np
     208    wlon = [np.min(lon2d),np.max(lon2d)]
     209    ind = np.array(lat2d).shape[0] / 2  ## to get a good boundlat and to get the pole
     210    wlat = [np.min(lat2d[ind,:]),np.max(lat2d[ind,:])]
     211    return [wlon,wlat]
    207212
    208213def simplinterv (lon2d,lat2d):
     
    365370    elif wlat[1] >= 0.:    blat = wlat[0]
    366371    elif wlat[0] <= 0.:    blat = wlat[1]
    367     print blat
     372    print "blat ", blat
    368373    h = 50.  ## en km
    369374    radius = 3397200.
     
    477482             "ICETOT":       "%.1e",\
    478483             "TAU_ICE":      "%.2f",\
     484             "VMR_ICE":      "%.1e",\
     485             "MTOT":         "%.0f",\
    479486             "anomaly":      "%.1f",\
    480487             "W":            "%.1f",\
     
    495502             "HFX":          "RdYlBu",\
    496503             "ICETOT":       "YlGnBu",\
     504             "MTOT":         "PuBu",\
    497505             "TAU_ICE":      "Blues",\
     506             "VMR_ICE":      "Blues",\
    498507             "W":            "jet",\
    499508             "anomaly":      "RdBu_r",\
Note: See TracChangeset for help on using the changeset viewer.