Changeset 914 in lmdz_wrf


Ignore:
Timestamp:
Jun 20, 2016, 8:01:02 PM (8 years ago)
Author:
lfita
Message:

Adding and working WRFua' and WRFva' rotated 3D winds!!

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diagnostics.inf

    r885 r914  
    2626tds, TStd, psfc@t@q
    2727tds, WRFtds, PSFC@T2@Q2
     28ua, WRFua, U@V@SINALPHA@COSALPHA
     29va, WRFva, U@V@SINALPHA@COSALPHA
    2830wds, TSwds, u@v
    2931wds, WRFwds, U10@V10
  • trunk/tools/diagnostics.py

    r884 r914  
    878878  'OMEGAw', 'RAINTOT',   \
    879879  'rvors', 'td', 'turbulence', 'WRFgeop', 'WRFp', 'WRFrvors', 'wds', 'wss',          \
    880   'WRFheight']
     880  'WRFheight', 'WRFua', 'WRFva']
    881881
    882882methods = ['accum', 'deaccum']
     
    887887  'WRFp', 'WRFtd',                                                                   \
    888888  'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs', 'WRFrhs', 'WRFrvors', \
    889   'WRFt', 'WRFtime', 'WRFwds', 'WRFwss', 'WRFheight']
     889  'WRFt', 'WRFtime', 'WRFua', 'WRFva', 'WRFwds', 'WRFwss', 'WRFheight']
    890890
    891891ofile = 'diagnostics.nc'
     
    14891489        ncvar.insert_variable(ncobj, 'ta', WRFt, dnames, dvnames, newnc)
    14901490
    1491 # WRFtime (u10, v10, WRFpos)
     1491# WRFua (U, V, SINALPHA, COSALPHA) to be rotated !!
     1492    elif diag == 'WRFua':
     1493        var0 = ncobj.variables[depvars[0]][:]
     1494        var1 = ncobj.variables[depvars[1]][:]
     1495        var2 = ncobj.variables[depvars[2]][:]
     1496        var3 = ncobj.variables[depvars[3]][:]
     1497
     1498        # un-staggering variables
     1499        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
     1500        ua = np.zeros(tuple(unstgdims), dtype=np.float)
     1501        unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
     1502        unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
     1503        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
     1504        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
     1505
     1506        for iz in range(var0.shape[1]):
     1507            ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
     1508
     1509        dnamesvar = list(ncobj.variables[depvars[0]].dimensions)
     1510        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     1511
     1512        ncvar.insert_variable(ncobj, 'ua', ua, dnames, dvnames, newnc)
     1513
     1514# WRFua (U, V, SINALPHA, COSALPHA) to be rotated !!
     1515    elif diag == 'WRFva':
     1516        var0 = ncobj.variables[depvars[0]][:]
     1517        var1 = ncobj.variables[depvars[1]][:]
     1518        var2 = ncobj.variables[depvars[2]][:]
     1519        var3 = ncobj.variables[depvars[3]][:]
     1520
     1521        # un-staggering variables
     1522        unstgdims = [var0.shape[0], var0.shape[1], var0.shape[2], var0.shape[3]-1]
     1523        va = np.zeros(tuple(unstgdims), dtype=np.float)
     1524        unstgvar0 = np.zeros(tuple(unstgdims), dtype=np.float)
     1525        unstgvar1 = np.zeros(tuple(unstgdims), dtype=np.float)
     1526        unstgvar0 = 0.5*(var0[:,:,:,0:var0.shape[3]-1] + var0[:,:,:,1:var0.shape[3]])
     1527        unstgvar1 = 0.5*(var1[:,:,0:var1.shape[2]-1,:] + var1[:,:,1:var1.shape[2],:])
     1528        for iz in range(var0.shape[1]):
     1529            va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
     1530
     1531        dnamesvar = list(ncobj.variables[depvars[0]].dimensions)
     1532        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     1533
     1534        ncvar.insert_variable(ncobj, 'va', va, dnames, dvnames, newnc)
     1535
     1536# WRFtime
    14921537    elif diag == 'WRFtime':
    14931538           
Note: See TracChangeset for help on using the changeset viewer.