[ncl-talk] questions on using vibeta to do mass-weighted vertical integration

Hui Ding hding101 at googlemail.com
Fri Jul 12 10:19:19 MDT 2019


Hello,
I have one more question. How do I control the range of vertical
integration? For instance, I am only interested in water vapor or latent
heating in the troposphere.  It seems that neither dpres_hybrid_ccm nor
wgt_vertical_n has a control of vertical range for integration. Thank you
very much!
Best,
Hui



On Thu, Jul 11, 2019 at 9:11 PM Dennis Shea <shea at ucar.edu> wrote:

> Hello,
>
> Please send all comments/questions to ncl-talk.
> ============
> [1] It is *not* necessary to interpolate to isobaric levels.
> [2] vibeta / wgt_vertical_n .... I do not want to llok at the fortran code
> used bi vibeta.
> It will take too much time. I think using wgt_vertical_n is the way to go.
>
>
>   diri = "./"
>   fili = "cam35.h0.0008-07.nc"
>   pthi = diri+fili
>   f    = addfile(pthi,"r")
>
> ;---read necessary variables
>
>   hyai = f->hyai ; read from a file the interface hybrid coefficients
>   hybi = f->hybi ; read from a file
>   ps   = f->PS   ; surface pressure [Pa]
> ;;p0   = 100000. ; same units as 'ps'
>   p0   = f->P0
>   T    = f->T    ; degK  ; T(time,level,lat,lon) ; dimension (0,1,2,3)
>
>   dp   = dpres_hybrid_ccm(ps,p0,hyai,hybi)   ; layer thickness
>   copy_VarCoords(T,dp)
>   printVarSummary(dp)
>   print("----------")
>
>   vopt = 0     ; vertically weighted average over the level (1-th
> dimension)
>   vavg = wgt_vertical_n(T, dp, vopt, 1)  ; (time,lat,lon)
>   vavg at long_name = "T*dp: vertically weighted average"
>   vavg at units     = "[K kg/(m s2)]"
>   printVarSummary(vavg)
>   print("----------")
>
>   vopt = 1     ; vertically weighted sum
>   vsum = wgt_vertical_n(T, dp, vopt, 1)  ; (time,lat,lon)
>   vsum at long_name = "T*dp: vertically weighted sum"
>   vsum at units     = "("+T at units+" - "+ps at units+")"
>   printVarSummary(vsum)
>   print("----------")
>
>   cp   = 1004.                               ; J/(K kg)     [ m2/(K s2) ]
>   g    = 9.81                                ; m/s
>   IE   = cp*vsum/g                             ; kg/s2
>   IE at long_name = "Vertically Integrated Internal Energy"
>   IE at units     = "kg/s2"
>   copy_VarCoords(vsum,IE)
>   printVarSummary(IE)
>   print("----------")
>
>
> On Wed, Jul 10, 2019 at 9:55 PM Hui Ding <hding101 at googlemail.com> wrote:
>
>> Hi Dennis,
>>
>> I have a few more questions. Assume that X is to be integrated
>> vertically. And, X is on hybrid levels in CAM5 outputs.
>>
>> 1. Is it necessary to interpolate X onto pressure coordinate first prior
>> to using wgt_vertical_n to do vertical integration? If not, which set of
>> levels (hyam/hybm or hyai/hybi) should I use to calculate dp?
>>
>> 2. What are the advantages of using wgt_vertical_n compared with using
>> vibeta in my case? Is it because I do not have to specify bottom to use
>> wgt_vertical_n?
>>
>> Thank you very much for your help!
>> Best regards,
>> Hui
>>
>>
>>
>>
>>
>> On Wed, Jul 10, 2019 at 3:31 PM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> I'd suggest using
>>>
>>>
>>> *http://www.ncl.ucar.edu/Document/Functions/Contributed/wgt_vertical_n.shtml*
>>> <http://www.ncl.ucar.edu/Document/Functions/Contributed/wgt_vertical_n.shtml>
>>> See Example 2
>>>
>>> On Wed, Jul 10, 2019 at 10:56 AM Hui Ding via ncl-talk <
>>> ncl-talk at ucar.edu> wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I am trying to calculate mass-weighted vertical integration of latent
>>>> heating from CESM LENS. I have a few questions on vibeta.
>>>>
>>>> 1. Latent heating is on hybrid levels in CAM5. Is it necessary to
>>>> interpolate data on to pressure levels prior to using vibeta?
>>>>
>>>> 2. Is it correct to use pbot and ptop to specify the range for vertical
>>>> integration? What if surface pressure is larger or smaller than pbot?
>>>>
>>>> Thank you very much!
>>>> Best,
>>>> Hui
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190712/1d5f1802/attachment.html>


More information about the ncl-talk mailing list