[ncl-talk] averaging of height levels

Gurer, Kemal@ARB kemal.gurer at arb.ca.gov
Mon Oct 19 16:15:15 MDT 2020


Hi ncl'ers,

I have a 3d array for the full model height levels, say, zfull(nlat,nlon,nlevs). I want to calculate the midpoints of the height levels of the full model heights and put it into a new  array, say zhalf(nlat,nlon,nlevs-1). The following code:

    do i=0,nlevs-2
       zhalf(:,:,i) = 0.5 * (zfull(:,:,i)+zfull(:,:,i+1))
    end do

or, the following code:

   zhalf = 0.5*( zfull(:,:,0:nlevs-2) + zfull(:,:,1:nlevs-1) )

generates some data, but I don't know and think what I am doing is right since the half height levels are strange. How can I calculate the mid-points of height levels of a 3d array of height levels?

Thank you for your help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201019/844afa13/attachment.html>


More information about the ncl-talk mailing list