Changeset 959 in lmdz_wrf for trunk/tools
- Timestamp:
- Jun 27, 2016, 12:05:22 PM (8 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diagnostics.inf
r925 r959 30 30 wds, TSwds, u@v 31 31 wds, wds, U10@V10 32 #ws, SPDUV, U@V32 ws, ws, U@V 33 33 #wss, SPDUV10, U10@V10 34 34 #wss, TSwss, u@v 35 35 wss, wss, U10@V10 36 wssturb, turbulence, wss 36 37 -
trunk/tools/diagnostics.py
r914 r959 877 877 availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', 'LMDZrh', 'mslp', \ 878 878 'OMEGAw', 'RAINTOT', \ 879 'rvors', 'td', 'turbulence', 'WRFgeop', 'WRFp', 'WRFrvors', 'w ds', 'wss',\879 'rvors', 'td', 'turbulence', 'WRFgeop', 'WRFp', 'WRFrvors', 'ws', 'wds', 'wss', \ 880 880 'WRFheight', 'WRFua', 'WRFva'] 881 881 … … 1382 1382 1383 1383 diagout, diagoutd, diagoutvd = compute_turbulence(var0,dnamesvar,dvnamesvar) 1384 valsvar = ncvar.variables_values(depvars) 1385 1386 ncvar.insert_variable(ncobj, valsvar[0] + 'turb', diagout, diagoutd, 1384 valsvar = gen.variables_values(depvars) 1385 1386 newvarn = depvars + 'turb' 1387 print main + '; Lluis newvarn:', newvarn 1388 ncvar.insert_variable(ncobj, newvarn, diagout, diagoutd, 1387 1389 diagoutvd, newnc) 1388 varobj = newnc.variables[valsvar[0] + 'turb'] 1390 print main + '; Lluis variables:', newnc.variables.keys() 1391 varobj = newnc.variables[newvarn] 1389 1392 attrv = varobj.long_name 1390 1393 attr = varobj.delncattr('long_name') … … 1507 1510 ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2 1508 1511 1509 dnamesvar = list(ncobj.variables[depvars[0]].dimensions) 1512 # dnamesvar = list(ncobj.variables[depvars[0]].dimensions) 1513 dnamesvar = ['Time','bottom_top','south_north','west_east'] 1510 1514 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1511 1515 … … 1529 1533 va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3 1530 1534 1531 dnamesvar = list(ncobj.variables[depvars[0]].dimensions)1535 dnamesvar = ['Time','bottom_top','south_north','west_east'] 1532 1536 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1533 1537 … … 1544 1548 ncvar.insert_variable(ncobj, 'time', diagout, dnamesvar, dvnamesvar, newnc) 1545 1549 1550 # ws (U, V) 1551 elif diag == 'ws': 1552 1553 var0 = ncobj.variables[depvars[0]][:] 1554 var1 = ncobj.variables[depvars[1]][:] 1555 # un-staggering variables 1556 unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1] 1557 va = np.zeros(tuple(unstgdims), dtype=np.float) 1558 unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float) 1559 unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float) 1560 unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]]) 1561 unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:]) 1562 1563 dnamesvar = ['Time','bottom_top','south_north','west_east'] 1564 diagout = np.sqrt(unstgvar0*unstgvar0 + unstgvar1*unstgvar1) 1565 1566 # dnamesvar = ncobj.variables[depvars[0]].dimensions 1567 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1568 1569 ncvar.insert_variable(ncobj, 'ws', diagout, dnamesvar, dvnamesvar, newnc) 1570 1546 1571 # wss (u10, v10) 1547 1572 elif diag == 'wss': … … 1554 1579 dnamesvar = ncobj.variables[depvars[0]].dimensions 1555 1580 dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames) 1556 1557 print 'dnamesvar',dnamesvar1558 print 'dnames',dnames1559 print 'dvnames',dvnames1560 print 'dvnamesvar',dvnamesvar1561 1581 1562 1582 ncvar.insert_variable(ncobj, 'wss', diagout, dnamesvar, dvnamesvar, newnc)
Note: See TracChangeset
for help on using the changeset viewer.