Changeset 428


Ignore:
Timestamp:
Nov 30, 2011, 11:22:27 AM (13 years ago)
Author:
acolaitis
Message:

PYTHON. Very simple modifications to allow for slices with LES files. Performance is not optimized and turbulence computations are not implemented. More to come in time.

Location:
trunk/UTIL/PYTHON
Files:
2 edited

Legend:

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

    r427 r428  
    3535    return ltst
    3636
    37 ## Author: AS
     37## Author: AS, AC
    3838def whatkindfile (nc):
    39     if 'controle' in nc.variables:   typefile = 'gcm'
    40     elif 'phisinit' in nc.variables: typefile = 'gcm'
    41     elif 'vert' in nc.variables:     typefile = 'mesoapi'
    42     elif 'U' in nc.variables:        typefile = 'meso'
    43     elif 'HGT_M' in nc.variables:    typefile = 'geo'
     39    if 'controle' in nc.variables:     typefile = 'gcm'
     40    elif 'phisinit' in nc.variables:   typefile = 'gcm'
     41    elif '9999' in getattr(nc,'START_DATE') : typefile = 'les'
     42    elif 'vert' in nc.variables:       typefile = 'mesoapi'
     43    elif 'U' in nc.variables:          typefile = 'meso'
     44    elif 'HGT_M' in nc.variables:      typefile = 'geo'
    4445    #else:                            errormess("whatkindfile: typefile not supported.")
    4546    else:                            typefile = 'gcm' # for lslin-ed files from gcm
     
    394395    elif typefile in ['geo']:
    395396        [lon2d,lat2d] = getcoord2d(nc,nlat='XLAT_M',nlon='XLONG_M')
     397    elif typefile in ['les']:
     398        nx=getattr(nc,'WEST-EAST_GRID_DIMENSION')
     399        ny=getattr(nc,'SOUTH-NORTH_GRID_DIMENSION')
     400        [lon2d,lat2d] = np.meshgrid(np.arange(nx),np.arange(ny))
    396401    return lon2d,lat2d   
    397402
     
    487492    if typefile is 'mesoapi':    [uchar,vchar] = ['Um','Vm']
    488493    elif typefile is 'gcm':      [uchar,vchar] = ['u','v']
    489     elif typefile is 'meso':     [uchar,vchar] = ['U','V']
     494    elif typefile in ['meso','les']:     [uchar,vchar] = ['U','V']
    490495    else:                        [uchar,vchar] = ['not found','not found']
    491496    ###
     
    10011006   return what_I_plot,x,y
    10021007
    1003 # Author: TN + AS
     1008# Author: TN + AS 
    10041009def determineplot(slon, slat, svert, stime):
    10051010    nlon = 1 # number of longitudinal slices -- 1 is None
     
    10221027    #else:
    10231028    #    nslices = 2 
    1024 
    10251029    mapmode = 0
    10261030    if slon is None and slat is None:
  • trunk/UTIL/PYTHON/planetoplot.py

    r427 r428  
    9292    numplot = zelen*nslices
    9393    print "********** FILES, SLICES, VARS, TOTAL PLOTS: ", len(namefiles), nslices, len(var), numplot
    94     print "********** MAPMODE: ", mapmode
    9594    if ope is not None:
    9695        if fileref is not None:       zelen = zelen + 2
     
    116115      ### ... TYPEFILE
    117116      typefile = whatkindfile(nc)                                 
     117      if typefile in ['les']:
     118          mapmode=0
     119          winds=False
     120      if firstfile: print "********** MAPMODE: ", mapmode
    118121      if firstfile:                 typefile0 = typefile
    119122      elif typefile != typefile0:   errormess("Not the same kind of files !", [typefile0, typefile])
     
    130133      [lon2d,lat2d] = getcoorddef(nc)
    131134      ### ... PROJECTION
    132       if proj == None:   proj = getproj(nc)                 
     135      if ((proj == None) and (typefile not in ['les'])):   proj = getproj(nc)                 
    133136
    134137##########################################################
     
    139142          else:                           errormess("no time axis found.")
    140143          vert = nc.variables["altitude"][:]
    141       elif typefile in ['meso','mesoapi','geo']:
     144      elif typefile in ['meso','mesoapi','geo','les']:
    142145          if vlon is not None or vlat is not None:   indices = bidimfind(lon2d,lat2d,vlon,vlat) ; print '********** INDICES: ', indices
    143146          if slon is not None: slon[0][0] = indices[0] ; slon[0][1] = indices[0]
     
    329332                     #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20)
    330333                     zelevels = np.linspace(zevmin,zevmax,num=ticks)
     334                     print np.array(x).shape
     335                     print np.array(y).shape
     336                     print np.array(what_I_plot).shape
     337
    331338                     if mapmode == 1:       m.contourf( x, y, what_I_plot, zelevels, cmap = palette)
    332339                     elif mapmode == 0:     contourf( x, y, what_I_plot, zelevels, cmap = palette)
Note: See TracChangeset for help on using the changeset viewer.