Changeset 1809 in lmdz_wrf


Ignore:
Timestamp:
Mar 16, 2018, 6:31:51 PM (7 years ago)
Author:
lfita
Message:

Adding:

  • `WRF_denszint': integration of a sum of variables with vertical dependency on density
  • 'NONcheckdepvars': list of variables without checking their dependencies
Location:
trunk/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diagnostics.inf

    r1804 r1809  
    5050zg, WRFght, PH@PHB
    5151zmla, WRFzmlagen, T@QVAPOR@WRFgeop@HGT
     52
     53# Specials (variables which depend on the selection)
     54varn WRF_denszint WRFdens@varn=clivi@QCLOUD@QICE@QGRAUPEL
  • trunk/tools/diagnostics.py

    r1806 r1809  
    7878availdiags = ['ACRAINTOT', 'accum', 'clt', 'cllmh', 'deaccum', 'LMDZrh', 'mslp',     \
    7979  'OMEGAw', 'RAINTOT',                                                               \
    80   'rvors', 'td', 'turbulence', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi', 'WRFgeop',    \
     80  'rvors', 'td', 'turbulence', 'WRFcape_afwa', 'WRFclivi', 'WRFclwvi',               \
     81  'WRF_denszint', 'WRFgeop',                                                         \
    8182  'WRFmrso', 'WRFpotevap_orPM', 'WRFp', 'WRFpsl_ecmwf',                              \
    8283  'WRFpsl_ptarget', 'WRFrvors', 'WRFslw', 'ws', 'wds', 'wss', 'WRFheight',           \
     
    8990  'WRFclivi', 'WRFclwvi', 'WRFdens', 'WRFgeop',                                      \
    9091  'WRFp', 'WRFtd',                                                                   \
    91   'WRFpos', 'WRFpotevap_orPM', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs',    \
     92  'WRFpos', 'WRFprc', 'WRFprls', 'WRFrh', 'LMDZrh', 'LMDZrhs',                       \
    9293  'WRFrhs', 'WRFrvors',                                                              \
    9394  'WRFt', 'WRFtime', 'WRFua', 'WRFva', 'WRFwds', 'WRFwss', 'WRFheight', 'WRFz']
     95
     96# diagnostics not to check their dependeny
     97NONcheckdepvars = ['WRF_denszint', 'WRFzwind_log', 'WRFzwind', 'WRFzwindMO']
    9498
    9599NONchkvardims = ['WRFtime']
     
    360364    diagn = diags[idiag].split('|')[0]
    361365    depvars = diags[idiag].split('|')[1].split('@')
    362     if diags[idiag].split('|')[1].find('@') != -1:
    363         depvars = diags[idiag].split('|')[1].split('@')
    364         if depvars[0] == 'deaccum': diagn='deaccum'
    365         if depvars[0] == 'accum': diagn='accum'
    366         for depv in depvars:
    367             if not ncobj.variables.has_key(depv) and not                             \
    368               gen.searchInlist(NONcheckingvars, depv) and                            \
    369               not gen.searchInlist(methods, depv) and not depvars[0] == 'deaccum'    \
    370               and not depvars[0] == 'accum' and not depv[0:2] == 'z=':
     366    if not gen.searchInlist(NONcheckdepvars, diagn):
     367        if diags[idiag].split('|')[1].find('@') != -1:
     368            depvars = diags[idiag].split('|')[1].split('@')
     369            if depvars[0] == 'deaccum': diagn='deaccum'
     370            if depvars[0] == 'accum': diagn='accum'
     371            for depv in depvars:
     372                if not ncobj.variables.has_key(depv) and not                         \
     373                  gen.searchInlist(NONcheckingvars, depv) and                        \
     374                  not gen.searchInlist(methods, depv) and not depvars[0] == 'deaccum'\
     375                  and not depvars[0] == 'accum' and not depv[0:2] == 'z=':
     376                    print errormsg
     377                    print '  ' + main + ": file '" + opts.ncfile +                   \
     378                      "' does not have variable '" + depv + "' !!"
     379                    quit(-1)
     380        else:
     381            depvars = diags[idiag].split('|')[1]
     382            if not ncobj.variables.has_key(depvars) and not                          \
     383              gen.searchInlist(NONcheckingvars, depvars) and                         \
     384              not gen.searchInlist(methods, depvars):
    371385                print errormsg
    372386                print '  ' + main + ": file '" + opts.ncfile +                       \
    373                   "' does not have variable '" + depv + "' !!"
     387                  "' does not have variable '" + depvars + "' !!"
    374388                quit(-1)
    375     else:
    376         depvars = diags[idiag].split('|')[1]
    377         if not ncobj.variables.has_key(depvars) and not                              \
    378           gen.searchInlist(NONcheckingvars, depvars) and                             \
    379           not gen.searchInlist(methods, depvars):
    380             print errormsg
    381             print '  ' + main + ": file '" + opts.ncfile +                           \
    382               "' does not have variable '" + depvars + "' !!"
    383             quit(-1)
    384389
    385390    print "\n    Computing '" + diagn + "' from: ", depvars, '...'
     
    745750
    746751        newvarn = depvars + 'turb'
    747         print main + '; Lluis newvarn:', newvarn
    748752        ncvar.insert_variable(ncobj, newvarn, diagout, diagoutd,
    749753          diagoutvd, newnc)
    750         print main + '; Lluis variables:', newnc.variables.keys()
    751754        varobj = newnc.variables[newvarn]
    752755        attrv = varobj.long_name
     
    847850            varsadd.append(nonvd)
    848851        ncvar.insert_variable(ncobj, 'clwvi', diagout, diagoutd, diagoutvd, newnc)
     852
     853# WRF_denszint WRF vertical integration as WRFdens, sum(Q[water species1], ..., Q[water speciesN]), varn=[varN]
     854    elif diagn == 'WRF_denszint':
     855           
     856        var0 = WRFdens
     857        varn = depvars[1].split('=')[1]
     858        qtot = ncobj.variables[depvars[2]]
     859        qtotv = ncobj.variables[depvars[2]]
     860        Nspecies = len(depvars) - 2
     861        for iv in range(Nspecies):
     862            if ncobj.variables.has_key(depvars[iv+2]):
     863                var1 = ncobj.variables[depvars[iv+2]]
     864                qtotv = qtotv + var1[:]
     865
     866        dnamesvar = list(qtot.dimensions)
     867        dvnamesvar = ncvar.var_dim_dimv(dnamesvar,dnames,dvnames)
     868
     869        diagout, diagoutd, diagoutvd = diag.compute_clwvl(var0, qtotv, dnamesvar,dvnamesvar)
     870
     871        # Removing the nonChecking variable-dimensions from the initial list
     872        varsadd = []
     873        diagoutvd = list(dvnames)
     874        for nonvd in NONchkvardims:
     875            if gen.searchInlist(dvnames,nonvd): diagoutvd.remove(nonvd)
     876            varsadd.append(nonvd)
     877        ncvar.insert_variable(ncobj, varn, diagout, diagoutd, diagoutvd, newnc)
    849878
    850879# WRFgeop geopotential from WRF as PH + PHB
  • trunk/tools/documentation/other/diagnostics.html

    r1808 r1809  
    113113       </TBODY>
    114114      </TABLE>
     115      Special diagnostics (variables which depend on the selection):<BR>
     116      <TABLE ID="t01">
     117       <THEAD>
     118         <TR><TH>CF Name</TH><TH>Name in script</TH><TH>variables</TH><TH>description</TH></TR>
     119       </THEAD>
     120       <TFOOT>
     121       </TFOOT>
     122       <TBODY>
     123         <TR><TD>[varn]</TD><TD>WRF_denszint</TD><TD>WRFdens@varn=clivi@QCLOUD@QICE@QGRAUPEL</TD><TD> Vertical mass integration (vertical density dependence) of a series of variables from WRF with name [varn]</TD></TR>
     124       </TBODY>
    115125    </DIV>
    116126    <DIV CLASS="valins">
Note: See TracChangeset for help on using the changeset viewer.