Changeset 426 for trunk/UTIL/PYTHON/planetoplot.py
- Timestamp:
- Nov 28, 2011, 10:59:33 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r425 r426 139 139 else: errormess("no time axis found.") 140 140 vert = nc.variables["altitude"][:] 141 elif typefile in ['meso','mesoapi' ]:141 elif typefile in ['meso','mesoapi','geo']: 142 142 if vlon is not None or vlat is not None: indices = bidimfind(lon2d,lat2d,vlon,vlat) ; print '********** INDICES: ', indices 143 143 if slon is not None: slon[0][0] = indices[0] ; slon[0][1] = indices[0] … … 150 150 else: londim='WEST-EAST_PATCH_END_UNSTAG' 151 151 lon = np.arange(0,getattr(nc,londim),1) ; lat = np.arange(0,getattr(nc,latdim),1) 152 if vertmode is None: vertmode=0153 if vertmode == 0: vert = np.arange(0,getattr(nc,vertdim),1)154 else: vert = nc.variables["vert"][:]155 152 time = np.arange(0,len(nc.variables["Times"]),1) 153 if typefile in ['geo']: vert = [0.] ; stime = readslices(str(0)) 154 else: 155 if vertmode is None: vertmode=0 156 if vertmode == 0: vert = np.arange(0,getattr(nc,vertdim),1) 157 else: vert = nc.variables["vert"][:] 156 158 #if firstfile: 157 159 # lat0 = lat … … 230 232 print "********************************************" 231 233 while error is False: 232 print "********** nplot", nplot, "error",error234 print "********** NPLOT", nplot 233 235 234 236 ### General plot settings … … 247 249 indexlat = getsindex(slat,((nplot-1)//nlon)%nlat,lat) 248 250 indexvert = getsindex(svert,((nplot-1)//(nlon*nlat))%nvert,vert) 249 250 251 if ope is not None: 251 252 if fileref is not None: index_f = ((nplot-1)//(nlon*nlat*nvert*ntime))%(len(namefiles)+2) ## OK only 1 var, see test in the beginning … … 261 262 if mapmode == 1 and stime is None: indextime = 1 262 263 else: indextime = getsindex(stime,((nplot-1)//(nlon*nlat*nvert))%ntime,time) 264 ltst = None 263 265 if typefile in ['mesoapi','meso'] and indextime is not None: ltst = localtime ( interv[0]+indextime*interv[1], 0.5*(wlon[0]+wlon[1]) ) 264 266 print "********** index lon, lat, vert, time ",indexlon,indexlat,indexvert,indextime … … 329 331 if mapmode == 1: m.pcolor( x, y, what_I_plot, cmap = palette, vmin=zevmin, vmax=zevmax ) 330 332 elif mapmode == 0: pcolor( x, y, what_I_plot, cmap = palette, vmin=zevmin, vmax=zevmax ) 331 if colorb != 'nobar' and varname != 'HGT' : 332 if (fileref is not None) and (index_f is numplot-1): 333 colorbar(fraction=0.05,pad=0.03,format="%.3f",\ 334 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,20])),\ 335 extend='neither',spacing='proportional') 336 else: 337 colorbar(fraction=0.05,pad=0.03,format=fmtvar(fvar.upper()),\ 338 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,20])),\ 339 extend='neither',spacing='proportional') 340 # both min max neither 333 if colorb != 'nobar': 334 if (fileref is not None) and (index_f is numplot-1): daformat = "%.3f" 335 else: daformat = fmtvar(fvar.upper()) 336 colorbar( fraction=0.05,pad=0.03,format=daformat,\ 337 ticks=np.linspace(zevmin,zevmax,num=min([ticks/2+1,20])),extend='neither',spacing='proportional' ) 341 338 ##### 1D field 342 339 elif len(what_I_plot.shape) is 1: … … 346 343 #### Other cases: (maybe plot 3-D field one day or movie ??) 347 344 else: 348 print "WARNING!!! ",len(what_I_plot.shape),"-D PLOT NOT SUPPORTED !!!" 349 print "field dimensions: ", what_I_plot.shape 350 exit() 351 345 print "WARNING!!! ",len(what_I_plot.shape),"-D PLOT NOT SUPPORTED !!! dimensions: ",what_I_plot.shape 346 errormess("Are you sure you did not forget to prescribe a dimension ?") 352 347 else: 353 348 errormess("There is an error in reducing field !") … … 382 377 if addchar: 383 378 [addchar,gogol,gogol2] = getlschar ( all_namefile[index_f] ) 384 plottitle = plottitle + addchar + "_LT"+str(ltst) 385 else: plottitle = plottitle + "_LT"+str(ltst) 379 plottitle = plottitle + addchar + "_LT" 380 else: plottitle = plottitle + "_LT" 381 if ltst is not None: plottitle = plottitle + str(ltst) 386 382 else: 387 383 if fileref is not None:
Note: See TracChangeset
for help on using the changeset viewer.