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

Joseph Clark jpclark186000 at gmail.com
Mon Jun 27 10:09:42 MDT 2022

```I think I explained the top/bottom a little off, but the equation is there.
Not really a forward difference. Sorry for any confusion.

On Mon, Jun 27, 2022 at 12:02 PM Joseph Clark <jpclark186000 at gmail.com>
wrote:

>
> 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:
>
>> 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...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220627/583c34e4/attachment.htm>
```