Changeset 959 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 27, 2016, 12:05:22 PM (8 years ago)
Author:
lfita
Message:

Adding `ws': air wind speed

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diagnostics.inf

    r925 r959  
    3030wds, TSwds, u@v
    3131wds, wds, U10@V10
    32 #ws, SPDUV, U@V
     32ws, ws, U@V
    3333#wss, SPDUV10, U10@V10
    3434#wss, TSwss, u@v
    3535wss, wss, U10@V10
     36wssturb, turbulence, wss
    3637
  • trunk/tools/diagnostics.py

    r914 r959  
    877877availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', 'LMDZrh', 'mslp',     \
    878878  'OMEGAw', 'RAINTOT',   \
    879   'rvors', 'td', 'turbulence', 'WRFgeop', 'WRFp', 'WRFrvors', 'wds', 'wss',          \
     879  'rvors', 'td', 'turbulence', 'WRFgeop', 'WRFp', 'WRFrvors', 'ws', 'wds', 'wss',    \
    880880  'WRFheight', 'WRFua', 'WRFva']
    881881
     
    13821382
    13831383        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,
    13871389          diagoutvd, newnc)
    1388         varobj = newnc.variables[valsvar[0] + 'turb']
     1390        print main + '; Lluis variables:', newnc.variables.keys()
     1391        varobj = newnc.variables[newvarn]
    13891392        attrv = varobj.long_name
    13901393        attr = varobj.delncattr('long_name')
     
    15071510            ua[:,iz,:,:] = unstgvar0[:,iz,:,:]*var3 - unstgvar1[:,iz,:,:]*var2
    15081511
    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']
    15101514        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
    15111515
     
    15291533            va[:,iz,:,:] = unstgvar0[:,iz,:,:]*var2 + unstgvar1[:,iz,:,:]*var3
    15301534
    1531         dnamesvar = list(ncobj.variables[depvars[0]].dimensions)
     1535        dnamesvar = ['Time','bottom_top','south_north','west_east']
    15321536        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
    15331537
     
    15441548        ncvar.insert_variable(ncobj, 'time', diagout, dnamesvar, dvnamesvar, newnc)
    15451549
     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
    15461571# wss (u10, v10)
    15471572    elif diag == 'wss':
     
    15541579        dnamesvar = ncobj.variables[depvars[0]].dimensions
    15551580        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
    1556 
    1557         print 'dnamesvar',dnamesvar
    1558         print 'dnames',dnames
    1559         print 'dvnames',dvnames
    1560         print 'dvnamesvar',dvnamesvar
    15611581
    15621582        ncvar.insert_variable(ncobj, 'wss', diagout, dnamesvar, dvnamesvar, newnc)
Note: See TracChangeset for help on using the changeset viewer.