- Timestamp:
- Mar 7, 2012, 7:20:51 PM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/create_ecmwf.py
r558 r571 28 28 area = "Whole" 29 29 ########################################################################## 30 var = ["130"] 31 fieldtype = "3d" 32 lev = ["1000.","900.","800.","700.","600."] 33 tim = ["00"] 34 date = ['01','09','2009','01','09','2009'] 35 area = "Whole" 30 36 31 37 ########################################################################## -
trunk/UTIL/PYTHON/myplot.py
r569 r571 91 91 else:out=field 92 92 return out 93 94 ## Author: AC 95 def windamplitude (nc) 96 varinfile = nc.variables.keys() 97 if "U" in varinfile: zu=getfield(nc,'U') 98 elif "Um" in varinfile: zu=getfield(nc,'Um') 99 if "V" in varinfile: zv=getfield(nc,'V') 100 elif "Vm" in varinfile: zv=getfield(nc,'Vm') 101 znt,znz,zny,znx = np.array(zu).shape 102 if "U" in varinfile:znx=znx-1 103 zuint = np.zeros([znt,znz,zny,znx]) 104 zvint = np.zeros([znt,znz,zny,znx]) 105 if "U" in varinfile: 106 for xx in np.arange(znx): zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2. 107 for yy in np.arange(zny): zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2. 108 else: 109 zuint=zu 110 zvint=zv 111 return np.sqrt(zuint**2 + zvint**2) 93 112 94 113 ## Author: AS + TN + AC -
trunk/UTIL/PYTHON/planetoplot.py
r570 r571 274 274 if var2: all_var2[k] = getfield(nc,var2) 275 275 if winds: all_windu[k] = getfield(nc,uchar) ; all_windv[k] = getfield(nc,vchar) 276 ##### SPECIFIC 276 ##################### 277 ##### GETFIELDS ##### 278 ##################### 279 ##### SPECIFIC CASES 280 ##### 1. saturation temperature 277 281 if varname in ["temp","t","T_nadir_nit","T_nadir_day","temp_day","temp_night"] and tsat: 278 282 tt=getfield(nc,varname) ; print "computing Tsat-T, I ASSUME Z-AXIS IS PRESSURE" … … 280 284 else: tinput=tt 281 285 all_var[k]=get_tsat(vert,tinput,zlon=lon,zlat=lat,zalt=vert,ztime=time) 286 ##### 2. wind amplitude 287 elif ((varname in ['UV','uv','uvmet']) and (typefile in ['meso']) and (varname not in nc.variables)): 288 all_var[k]=windamplitude(nc) 282 289 else: 283 290 ##### GENERAL STUFF HERE 284 if ((varname in ['UV','uv','uvmet']) and (typefile in ['meso']) and (varname not in nc.variables)): 285 if "U" in varinfile: zu=getfield(nc,'U') 286 elif "Um" in varinfile: zu=getfield(nc,'Um') 287 if "V" in varinfile: zv=getfield(nc,'V') 288 elif "Vm" in varinfile: zv=getfield(nc,'Vm') 289 znt,znz,zny,znx = np.array(zu).shape 290 if "U" in varinfile:znx=znx-1 291 zuint = np.zeros([znt,znz,zny,znx]) 292 zvint = np.zeros([znt,znz,zny,znx]) 293 if "U" in varinfile: 294 for xx in np.arange(znx): 295 zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2. 296 for yy in np.arange(zny): 297 zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2. 298 else: 299 zuint=zu 300 zvint=zv 301 all_var[k] = np.sqrt(zuint**2 + zvint**2) 302 else: 303 all_var[k] = getfield(nc,varname) 304 291 all_var[k] = getfield(nc,varname) 305 292 print "**** GOT SUBDATA:",k," NAMEFILE:",namefile," VAR:",varname, var2 ; k += 1 ; firstfile = False 306 293 #### End of for namefile in namefiles … … 314 301 if ope in ["-","+","-%"]: 315 302 if fileref is not None: 316 317 if ((all_varname[k-1] in ['UV','uv','uvmet']) and (typefile in ['meso']) and (all_varname[k-1] not in Dataset(fileref).variables)): 318 if "U" in varinfile: zu=getfield(Dataset(fileref),'U') 319 elif "Um" in varinfile: zu=getfield(Dataset(fileref),'Um') 320 if "V" in varinfile: zv=getfield(Dataset(fileref),'V') 321 elif "Vm" in varinfile: zv=getfield(Dataset(fileref),'Vm') 322 znt,znz,zny,znx = np.array(zu).shape 323 if "U" in varinfile:znx=znx-1 324 zuint = np.zeros([znt,znz,zny,znx]) 325 zvint = np.zeros([znt,znz,zny,znx]) 326 if "U" in varinfile: 327 for xx in np.arange(znx): 328 zuint[:,:,:,xx] = (zu[:,:,:,xx] + zu[:,:,:,xx+1])/2. 329 for yy in np.arange(zny): 330 zvint[:,:,yy,:] = (zv[:,:,yy,:] + zv[:,:,yy+1,:])/2. 331 else: 332 zuint=zu 333 zvint=zv 334 all_var[k] = np.sqrt(zuint**2 + zvint**2) 303 ncref = Dataset(fileref) 304 if ((all_varname[k-1] in ['UV','uv','uvmet']) and (typefile in ['meso']) and (all_varname[k-1] not in ncref.variables)): 305 all_var[k] = windamplitude(ncref) 335 306 else: 336 all_var[k] = getfield(Dataset(fileref),all_varname[k-1]) 337 307 all_var[k] = getfield(ncref,all_varname[k-1]) 338 308 all_varname[k] = all_varname[k-1] ; all_time[k] = all_time[k-1] ; all_namefile[k] = all_namefile[k-1] ; all_var2[k] = all_var2[k-1] 339 340 309 else: errormess("fileref is missing!") 341 310 if ope == "-": all_var[k+1]= all_var[k-1] - all_var[k] … … 510 479 511 480 if which == "unidim": 512 #lbls = ["<TH+RiSL+MY4> tau=0.5","<Convadj> tau=0.5","<TH+RiSL+MY4> tau=1","<Convadj> tau=1"]513 481 lbl = "" 514 482 if indexlat is not None: lbl = lbl + " ix" + str(indexlat[0])
Note: See TracChangeset
for help on using the changeset viewer.