# [ncl-talk] How does dpres_plevel determine pressure weights

Joseph Clark jpclark186000 at gmail.com
Mon Jun 27 10:02:31 MDT 2022

```Thanks Dave, very helpful.

For anyone who may want to know in the future (if such an individual
exists), here is the relevant loop that I found in the source code:

dplvl(1) = (plvl(1)+plvl(2))*0.5d0 - ptop do kl=2,klvl-1 dplvl(kl)= 0.5d0*
(plvl(kl+1) - plvl(kl-1)) end do dplvl(klvl) = psfcmx -(plvl(klvl)+plvl(klvl
-1))*0.5d0

The dp's are centered differences except at the top and bottom. At the top,
the dp's are a forward difference divided by 2, minus the pressure at the
top (which is input into the function) and then at the bottom the dp's are
equal to the surface pressure minus a forward difference divided by 2.

Joe

On Sun, Jun 26, 2022 at 7:52 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Download the 6.6.2 source code distribution from the NCL website.  Within,
> that function is in ni/src/lib/nfpfort/dpres_plevel_dp.f.  It is called by
> a C wrapper function which can be found in ni/src/lib/nfp/preshybW.c.
>
> You can also browse the NCL source code on the NCL github site.
>
>
> On Sun, Jun 26, 2022 at 12:16 PM Joseph Clark via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Hi NCL users,
>>
>> Does anyone know where I can find the source code for the function
>> dpres_plevel? I'm confused about the exact formula used to determine
>> pressure weights, particularly near the surface and TOA. There clearly is a
>> constraint that the sum of dp's adds to the surface pressure, but I'm not
>> sure exactly what's going on in the function.
>>
>> Joseph\
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...