Changeset 428
- Timestamp:
- Nov 30, 2011, 11:22:27 AM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r427 r428 35 35 return ltst 36 36 37 ## Author: AS 37 ## Author: AS, AC 38 38 def 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' 44 45 #else: errormess("whatkindfile: typefile not supported.") 45 46 else: typefile = 'gcm' # for lslin-ed files from gcm … … 394 395 elif typefile in ['geo']: 395 396 [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)) 396 401 return lon2d,lat2d 397 402 … … 487 492 if typefile is 'mesoapi': [uchar,vchar] = ['Um','Vm'] 488 493 elif typefile is 'gcm': [uchar,vchar] = ['u','v'] 489 elif typefile i s 'meso': [uchar,vchar] = ['U','V']494 elif typefile in ['meso','les']: [uchar,vchar] = ['U','V'] 490 495 else: [uchar,vchar] = ['not found','not found'] 491 496 ### … … 1001 1006 return what_I_plot,x,y 1002 1007 1003 # Author: TN + AS 1008 # Author: TN + AS 1004 1009 def determineplot(slon, slat, svert, stime): 1005 1010 nlon = 1 # number of longitudinal slices -- 1 is None … … 1022 1027 #else: 1023 1028 # nslices = 2 1024 1025 1029 mapmode = 0 1026 1030 if slon is None and slat is None: -
trunk/UTIL/PYTHON/planetoplot.py
r427 r428 92 92 numplot = zelen*nslices 93 93 print "********** FILES, SLICES, VARS, TOTAL PLOTS: ", len(namefiles), nslices, len(var), numplot 94 print "********** MAPMODE: ", mapmode95 94 if ope is not None: 96 95 if fileref is not None: zelen = zelen + 2 … … 116 115 ### ... TYPEFILE 117 116 typefile = whatkindfile(nc) 117 if typefile in ['les']: 118 mapmode=0 119 winds=False 120 if firstfile: print "********** MAPMODE: ", mapmode 118 121 if firstfile: typefile0 = typefile 119 122 elif typefile != typefile0: errormess("Not the same kind of files !", [typefile0, typefile]) … … 130 133 [lon2d,lat2d] = getcoorddef(nc) 131 134 ### ... PROJECTION 132 if proj == None: proj = getproj(nc)135 if ((proj == None) and (typefile not in ['les'])): proj = getproj(nc) 133 136 134 137 ########################################################## … … 139 142 else: errormess("no time axis found.") 140 143 vert = nc.variables["altitude"][:] 141 elif typefile in ['meso','mesoapi','geo' ]:144 elif typefile in ['meso','mesoapi','geo','les']: 142 145 if vlon is not None or vlat is not None: indices = bidimfind(lon2d,lat2d,vlon,vlat) ; print '********** INDICES: ', indices 143 146 if slon is not None: slon[0][0] = indices[0] ; slon[0][1] = indices[0] … … 329 332 #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20) 330 333 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 331 338 if mapmode == 1: m.contourf( x, y, what_I_plot, zelevels, cmap = palette) 332 339 elif mapmode == 0: contourf( x, y, what_I_plot, zelevels, cmap = palette)
Note: See TracChangeset
for help on using the changeset viewer.