# [ncl-talk] How to calculate vertically integrated moisture budget

Dennis Shea shea at ucar.edu
Tue Jul 16 07:30:32 MDT 2019

```Usually, products from operational centers have array (variables) ordered
North->South.

NCL's spherical harmonics require the data to be ordered South->North.
Since you are using products [eg: u*q], the other variables must also be
reordered.
This is easy to address via NCL syntax

q=short2flt(f->q) ; units= kg kg-1
u=short2flt(g->u)
v=short2flt(h->v)
sfp=short2flt(i->sp)        ;units=pa, time*lat*lon

; Reverse the order

q := q(:,:,::-1,:)
u := u(:,:,::-1,:)
v := v(:,:,::-1,:)
sph := sph(:,:,::-1,:)

etc

A very quick view of the code is that it looks 'ok'

On Tue, Jul 16, 2019 at 5:30 AM 최화진(환경공학부) via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Dear all,
>
> Hello.
> I am trying to calculate vertically integrated moisture budget.
> I used "uv2dvF" and "wgt_vertical_n" functions because these data have
> regular grid and pressure coordinate.
> I am worried about whether the following script is correct or not.
>
> ","r")
> ","r")
> ","r")
> 1231.nc","r")
>
> q=short2flt(f->q) ; units= kg kg-1
> u=short2flt(g->u)
> v=short2flt(h->v)
> sfp=short2flt(i->sp) ;units=pa, time*lat*lon
>
> lon=f->lon
> lat=f->lat
> time=f->time
> sfp=sfp*0.01
> sfp at units="millibars"
> lev=f->level
> printVarSummary(lev)
>
> u_q=u*q
> v_q=v*q
>
> CV=uv2dvF_Wrap(u_q,v_q)
>
> ptop=10
> grav=9.8
> vopt=1
>
> dp=dpres_plevel_Wrap(lev,sfp,ptop,0) ;time*level*lat*lon
> cv_integ=wgt_vertical_n(CV,dp,vopt,1)
>
> cv=cv_integ*86400 ; for mm/day
> cv=cv/grav
> cv!0="time"
> cv!1="latitude"
> cv!2="longitude"
> cv&latitude=lat
> cv&longitude=lon
> cv&time=time
> cv=-cv
>
> If you could get back to me, I'd appreciate it.
> Thanks for your time and consideration.
>
> Best Regards,
>
> Hwa-Jin Cho
>
> *********************************************************************
> ****************************
> Hwa-Jin Choi
> Climate Change Research Lab (CCRL),
> Division of Environmental Science and Engineering,
> Pohang University of Science and Technology (POSTECH)
>  77, Cheongam-ro, Nam-gu, Pohang, Kyongbuk, 37673, South Korea
> *********************************************************************
> ****************************
>
> _______________________________________________
> 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/20190716/3115f585/attachment.html>
```