[ncl-talk] Integrate a variable
Guido Cioni
guidocioni at gmail.com
Sat Jun 11 01:04:33 MDT 2016
Hey Erick,
if you need to integrate over a certain depth I believe you can write the function yourself. I did something similar in one of my scripts:
;;;; first compute the pressure layers thicknesses ;;;
dp=new(dim sizes(height),typeof(p))
do i=0,dimsizes(time)-1
dp(i,:)=dpres_plevel(p(i,:),pres_sfc(i),p(i,0),0)
end do
; then compute the integral by summing the contribution of every layer
; note that NCL does the sum without looping, so everything should be fast
; also with big arrays
var_int=dim_sum_n(var*dp, 1)/g
I was using domain-averaged data, so with coordinates (time,z) but you can easily adapt the script for 2D (lat,lon) data.
Cheers
Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/>
> On 11 Jun 2016, at 03:36, Erick Gordon <erick.gordon24 at gmail.com> wrote:
>
> Hi
> I need to know how I can calculate the integral of a variable in NCL. In the case of wgt_vertical_n function will only be available from version 6.4.0 and later. For example, I need to integrate the divergence of moisture flux from 1000 to 500 hPa. If anyone can help me I would be grateful
> Thank you very much
> _______________________________________________
> 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/20160611/6d9af345/attachment.html
More information about the ncl-talk
mailing list