Changeset 1980 in lmdz_wrf
- Timestamp:
- Jul 25, 2018, 8:50:16 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r1909 r1980 17 17 # compute_turbulence: Function to compute the rubulence term of the Taylor's decomposition ...' 18 18 # C_diagnostic: Class to compute generic variables 19 # compute_wd: Function to compute the wind direction 3D 19 20 # compute_wds: Function to compute the wind direction 20 21 # compute_wss: Function to compute the wind speed … … 1453 1454 1454 1455 return turb, turbdims, turbvdims 1456 1457 def compute_wd(u, v, dimns, dimvns): 1458 """ Function to compute the wind direction 1459 [u]= W-E wind direction [ms-1, knot, ...] 1460 [v]= N-S wind direction [ms-1, knot, ...] 1461 [dimns]= list of the name of the dimensions of [u] 1462 [dimvns]= list of the name of the variables with the values of the 1463 dimensions of [u] 1464 """ 1465 fname = 'compute_wds' 1466 1467 # print ' ' + fname + ': computing wind direction as ATAN2(v,u) ...' 1468 theta = np.arctan2(v,u) 1469 theta = np.where(theta < 0., theta + 2.*np.pi, theta) 1470 1471 var = 360.*theta/(2.*np.pi) 1472 1473 vardims = dimns[:] 1474 varvdims = dimvns[:] 1475 1476 return var, vardims, varvdims 1455 1477 1456 1478 def compute_wds(u, v, dimns, dimvns): -
trunk/tools/diagnostics.inf
r1977 r1980 47 47 wa, OMEGAw, vitw@pres@temp 48 48 wds, TSwds, u@v 49 wd, WRFwd, U@V@SINALPHA@COSALPHA 49 50 wds, wds, U10@V10 # WRF 50 51 ws, ws, U@V -
trunk/tools/diagnostics.py
r1970 r1980 1312 1312 ncvar.insert_variable(ncobj, 'va', va, dnames, diagoutvd, newnc) 1313 1313 1314 1315 # WRFwd (U, V, SINALPHA, COSALPHA) to be rotated !! 1316 elif diagn == 'WRFwd': 1317 var0 = ncobj.variables[depvars[0]][:] 1318 var1 = ncobj.variables[depvars[1]][:] 1319 var2 = ncobj.variables[depvars[2]][:] 1320 var3 = ncobj.variables[depvars[3]][:] 1321 1322 # un-staggering variables 1323 unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1] 1324 ua = np.zeros(tuple(unstgdims), dtype=np.float) 1325 va = np.zeros(tuple(unstgdims), dtype=np.float) 1326 unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float) 1327 unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float) 1328 unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]]) 1329 unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:]) 1330 1331 for iz in range(var0.shape[1]): 1332 ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2 1333 va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3 1334 1335 dnamesvar = ['Time','bottom_top','south_north','west_east'] 1336 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1337 1338 wd, dnames, dvnames = diag.compute_wd(ua, va, dnamesvar, dvnamesvar) 1339 1340 # Removing the nonChecking variable-dimensions from the initial list 1341 varsadd = [] 1342 diagoutvd = list(dvnames) 1343 for nonvd in NONchkvardims: 1344 if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd) 1345 varsadd.append(nonvd) 1346 1347 ncvar.insert_variable(ncobj, 'wd', wd, dnames, diagoutvd, newnc) 1348 1314 1349 # WRFtime 1315 1350 elif diagn == 'WRFtime':
Note: See TracChangeset
for help on using the changeset viewer.