Changeset 399 for trunk/UTIL/PYTHON/planetoplot.py
- Timestamp:
- Nov 18, 2011, 8:43:59 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot.py
r398 r399 18 18 var=None,\ 19 19 colorb="def",\ 20 winds= True,\20 winds=False,\ 21 21 addchar=None,\ 22 22 interv=[0,1],\ … … 64 64 fmtvar,definecolorvec,defcolorb,getprefix,putpoints,calculate_bounds,errormess,definesubplot,\ 65 65 zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow,\ 66 getname,localtime,polarinterv,getsindex,define_axis,determineplot,readslices 66 getname,localtime,polarinterv,getsindex,define_axis,determineplot,readslices,bidimfind,getlschar 67 67 from mymath import deg,max,min,mean,get_tsat 68 68 import matplotlib as mpl … … 86 86 ################################ 87 87 nlon, nlat, nvert, ntime, mapmode, nslices = determineplot(slon, slat, svert, stime) 88 vlon = None ; vlat = None 89 if slon is not None: vlon = slon[0][0] 90 if slat is not None: vlat = slat[0][0] 88 91 if mapmode == 0: winds=False 89 92 elif mapmode == 1: … … 93 96 print "********** FILES, SLICES, VARS, TOTAL PLOTS: ", len(namefiles), nslices, len(var), numplot 94 97 print "********** MAPMODE: ", mapmode 95 if fileref is not None: all_var = [[]]*(zelen+2) ; all_varname = [[]]*(zelen+2) 96 else: all_var = [[]]*zelen ; all_var2 = [[]]*zelen ; all_title = [[]]*zelen ; all_varname = [[]]*zelen 98 if fileref is not None: all_var = [[]]*(zelen+2) ; all_varname = [[]]*(zelen+2) ; all_namefile = [[]]*(zelen+2) 99 else: all_var = [[]]*zelen ; all_var2 = [[]]*zelen ; all_title = [[]]*zelen ; all_varname = [[]]*zelen ; all_namefile = [[]]*zelen 97 100 98 101 ################################################################################################# 99 102 ### Loop over the files + vars initially separated by commas to be plotted on the same figure ### 100 103 ################################################################################################# 101 k = 0 102 firstfile = True 104 k = 0 ; firstfile = True 103 105 for nnn in range(len(namefiles)): 104 106 for vvv in range(len(var)): … … 127 129 if not varname and not winds: errormess("please set at least winds or var",printvar=nc.variables) 128 130 ### ... COORDINATES, could be moved below 129 [lon2d,lat2d] = getcoorddef(nc) 131 [lon2d,lat2d] = getcoorddef(nc) 130 132 ### ... PROJECTION 131 133 if proj == None: proj = getproj(nc) … … 144 146 vert = nc.variables["altitude"][:] 145 147 elif typefile in ['meso','mesoapi']: 148 if vlon is not None or vlat is not None: indices = bidimfind(lon2d,lat2d,vlon,vlat) ; print '********** INDICES: ', indices 149 if slon is not None: slon[0][0] = indices[0] ; slon[0][1] = indices[0] 150 if slat is not None: slat[0][0] = indices[1] ; slat[0][1] = indices[1] 146 151 if varname in ['PHTOT','W']: vertdim='BOTTOM-TOP_PATCH_END_STAG' 147 152 else: vertdim='BOTTOM-TOP_PATCH_END_UNSTAG' … … 173 178 else: [wlon,wlat] = simplinterv(lon2d,lat2d) 174 179 if zoom: [wlon,wlat] = zoomset(wlon,wlat,zoom) 175 ### ... NAME FOR TITLE and FILE (have to do something for multiple vars...)176 basename = getname(var=varname,winds=winds,anomaly=anomaly)177 basename = basename + getstralt(nc,level) ## can be moved elsewhere for a more generic routine178 180 179 181 ##### SPECIFIC … … 183 185 else: tinput=tt 184 186 all_var[k]=get_tsat(vert,tinput,zlon=lon,zlat=lat,zalt=vert,ztime=time) 185 all_varname[k] = varname186 187 else: 187 188 ##### GENERAL STUFF HERE 188 189 all_var[k] = getfield(nc,varname) 189 all_varname[k] = varname 190 all_varname[k] = varname 191 all_namefile[k] = namefile 190 192 if var2: all_var2[k] = getfield(nc,var2) 191 193 … … 208 210 numplot = numplot+2 209 211 elif ope in ["cat"]: 210 tab = all_var[0];k = 0212 tab = all_var[0];k = 1 211 213 while k != len(namefiles)-1: 212 214 tab = np.append(tab,all_var[k],axis=0) … … 276 278 #print slon, slat, svert, stime 277 279 #print index_f 278 #print "index lon,lat,vert,time", max(indexlon), max(indexlat), max(indexvert), max(indextime)280 #print "index lon,lat,vert,time", indexlon, indexlat, indexvert, indextime 279 281 #if varname != all_varname[index_f]: indextime = first 280 282 #################################################################### … … 401 403 ### Next subplot 402 404 basename = getname(var=varname,winds=winds,anomaly=anomaly) 405 basename = basename + getstralt(nc,level) 403 406 if typefile in ['mesoapi','meso']: 407 if slon is not None: basename = basename + "_lon_" + str(int(lon2d[indices[1],indices[0]])) 408 if slat is not None: basename = basename + "_lat_" + str(int(lat2d[indices[1],indices[0]])) 404 409 plottitle = basename 405 if addchar: plottitle = plottitle + addchar + "_LT"+str(ltst) 410 if addchar: 411 [addchar,gogol,gogol2] = getlschar ( all_namefile[index_f] ) 412 plottitle = plottitle + addchar + "_LT"+str(ltst) 406 413 else: plottitle = plottitle + "_LT"+str(ltst) 407 414 else:
Note: See TracChangeset
for help on using the changeset viewer.