Changeset 548 for trunk/UTIL/PYTHON/planetoplot.py
- Timestamp:
- Mar 1, 2012, 12:50:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r525 r548 126 126 ### ... TYPEFILE 127 127 typefile = whatkindfile(nc) 128 if typefile in ['mesoideal']: mapmode=0 129 elif typefile in ['gcm'] and len(nc.variables["longitude"][:]) is 1 and len(nc.variables["latitude"][:]) is 1: mapmode=0 130 elif typefile in ['earthgcm'] and len(nc.variables["lon"][:]) is 1 and len(nc.variables["lat"][:]) is 1: mapmode=0 131 if mapmode == 0: winds=False 132 elif mapmode == 1 and redope is None: 128 if typefile in ['gcm'] and len(nc.variables["longitude"][:]) is 1 and len(nc.variables["latitude"][:]) is 1: mapmode=0 ; winds=False 129 elif typefile in ['earthgcm'] and len(nc.variables["lon"][:]) is 1 and len(nc.variables["lat"][:]) is 1: mapmode=0 ; winds=False 130 if redope is None and mapmode == 1: 133 131 if svert is None: svert = readslices(str(level)) ; nvert=1 134 132 if stime is None and mrate is None: … … 152 150 [lon2d,lat2d] = getcoorddef(nc) 153 151 ### ... PROJECTION 154 if ((proj == None) and (typefile not in ['mesoideal'])): proj = getproj(nc)152 if proj == None: proj = getproj(nc) 155 153 156 154 if firstfile: … … 184 182 time = (initime+time*24)%24 185 183 print "LOCAL TIMES.... ", time 186 elif typefile in ['meso',' mesoapi','geo','mesoideal']:184 elif typefile in ['meso','geo']: 187 185 area = None ## not active for the moment 188 186 ###### STUFF TO GET THE CORRECT LAT/LON FROM MESOSCALE FILES WITH 2D LAT/LON ARRAYS … … 208 206 lonp,latp = ( lon2d[indices[0,0,0],indices[0,0,1]] , lat2d[indices[0,0,0],indices[0,0,1]] ) 209 207 ###### 210 if typefile in ['meso api','meso'] and mapmode == 1: lon2d = dumpbdy(lon2d,6) ; lat2d = dumpbdy(lat2d,6) ### important to do that now and not before208 if typefile in ['meso'] and mapmode == 1: lon2d = dumpbdy(lon2d,6) ; lat2d = dumpbdy(lat2d,6) ### important to do that now and not before 211 209 ###### 212 210 if varname in ['PHTOT','W']: vertdim='BOTTOM-TOP_PATCH_END_STAG' … … 333 331 else: indextime = getsindex(stime,((nplot-1)//(nlon*nlat*nvert))%ntime,time) 334 332 ltst = None 335 if typefile in ['meso api','meso'] and indextime is not None: ltst = localtime ( interv[0]+indextime*interv[1], 0.5*(wlon[0]+wlon[1]) )333 if typefile in ['meso'] and indextime is not None: ltst = localtime ( interv[0]+indextime*interv[1], 0.5*(wlon[0]+wlon[1]) ) 336 334 print "********** INDEX LON:",indexlon," LAT:",indexlat," VERT:",indexvert," TIME:",indextime 337 335 ##var = nc.variables["phisinit"][:,:] … … 443 441 m = define_proj(proj,wlon,wlat,back=back,blat=blat,blon=blon) ## this is dirty, defined above but out of imov loop 444 442 x, y = m(lon2d, lat2d) ## this is dirty, defined above but out of imov loop 445 if typefile in ['meso api','meso'] and mapmode == 1: what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True)443 if typefile in ['meso'] and mapmode == 1: what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True) 446 444 # if typefile in ['mesoideal']: what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag) 447 445 … … 471 469 #zelevels = np.linspace(zevmin*(1. + 1.e-7),zevmax*(1. - 1.e-7)) #,num=20) 472 470 zelevels = np.linspace(zevmin,zevmax,num=ticks) 471 #what_I_plot_frame = smooth(what_I_plot_frame,100) 473 472 if mapmode == 1: m.contourf( x, y, what_I_plot_frame, zelevels, cmap = palette, alpha=trans) 474 473 elif mapmode == 0: contourf( x, y, what_I_plot_frame, zelevels, cmap = palette, alpha=trans) … … 487 486 if zeorientation == "horizontal" and zetitle != "fill": zecb.ax.set_xlabel(zetitle) ; zetitle="" 488 487 if winds: 489 if typefile in ['meso api','meso']:488 if typefile in ['meso']: 490 489 [vecx_frame,vecy_frame] = [dumpbdy(vecx_frame,6,stag=uchar,condition=True), dumpbdy(vecy_frame,6,stag=vchar,condition=True)] 491 490 key = True 492 491 elif typefile in ['gcm']: 493 492 key = False 494 if metwind :[vecx_frame,vecy_frame] = m.rotate_vector(vecx_frame, vecy_frame, lon2d, lat2d)493 if metwind and mapmode == 1: [vecx_frame,vecy_frame] = m.rotate_vector(vecx_frame, vecy_frame, lon2d, lat2d) 495 494 if var: colorvec = definecolorvec(back) 496 495 else: colorvec = definecolorvec(colorb) … … 559 558 basename = basename + getstralt(nc,level) 560 559 if mrate is not None: basename = "movie_" + basename 561 if typefile in ['meso api','meso']:560 if typefile in ['meso']: 562 561 if slon is not None: basename = basename + "_lon_" + str(int(round(lonp))) 563 562 if slat is not None: basename = basename + "_lat_" + str(int(round(latp))) … … 598 597 ### Save the figure in a file in the data folder or an user-defined folder 599 598 if outputname is None: 600 if typefile in ['meso' ,'mesoapi']: prefix = getprefix(nc)599 if typefile in ['meso']: prefix = getprefix(nc) 601 600 elif typefile in ['gcm']: prefix = 'LMD_GCM_' 602 601 else: prefix = ''
Note: See TracChangeset
for help on using the changeset viewer.