<div dir="ltr">Thanks Dave, very helpful.<br><br>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:<br><br><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container gmail-js-code-nav-container gmail-js-tagsearch-file" style="border-spacing:0px;border-collapse:collapse;color:rgb(36,41,47);font-family:-apple-system,"system-ui","Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-LC74" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre"> dplvl(<span class="gmail-pl-c1" style="box-sizing:border-box">1</span>) <span class="gmail-pl-k" style="box-sizing:border-box">=</span> (plvl(<span class="gmail-pl-c1" style="box-sizing:border-box">1</span>)<span class="gmail-pl-k" style="box-sizing:border-box">+</span>plvl(<span class="gmail-pl-c1" style="box-sizing:border-box">2</span>))<span class="gmail-pl-k" style="box-sizing:border-box">*</span><span class="gmail-pl-c1" style="box-sizing:border-box">0.5d0</span> <span class="gmail-pl-k" style="box-sizing:border-box">-</span> ptop
<span class="gmail-pl-k" style="box-sizing:border-box"> do</span> kl<span class="gmail-pl-k" style="box-sizing:border-box">=</span><span class="gmail-pl-c1" style="box-sizing:border-box">2</span>,klvl<span class="gmail-pl-c1" style="box-sizing:border-box">-1</span>
dplvl(kl)<span class="gmail-pl-k" style="box-sizing:border-box">=</span> <span class="gmail-pl-c1" style="box-sizing:border-box">0.5d0</span><span class="gmail-pl-k" style="box-sizing:border-box">*</span>(plvl(kl<span class="gmail-pl-c1" style="box-sizing:border-box">+1</span>) <span class="gmail-pl-k" style="box-sizing:border-box">-</span> plvl(kl<span class="gmail-pl-c1" style="box-sizing:border-box">-1</span>))
<span class="gmail-pl-k" style="box-sizing:border-box"> end do
</span> dplvl(klvl) <span class="gmail-pl-k" style="box-sizing:border-box">=</span> psfcmx <span class="gmail-pl-k" style="box-sizing:border-box">-</span>(plvl(klvl)<span class="gmail-pl-k" style="box-sizing:border-box">+</span>plvl(klvl<span class="gmail-pl-c1" style="box-sizing:border-box">-1</span>))<span class="gmail-pl-k" style="box-sizing:border-box">*</span><span class="gmail-pl-c1" style="box-sizing:border-box">0.5d0</span>
</td></tr><tr style="box-sizing:border-box"><td id="gmail-L75" class="gmail-blob-num gmail-js-line-number gmail-js-code-nav-line-number gmail-js-blob-rnum" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;line-height:20px;text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-LC75" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre"><br></td></tr></tbody></table><div>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.<br><br>Joe</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 26, 2022 at 7:52 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">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.</div><div dir="ltr"><br></div><div>You can also browse the NCL source code on the NCL github site.</div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 26, 2022 at 12:16 PM Joseph Clark via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi NCL users,<br><br>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.<br><br>Joseph\</div>
</blockquote></div></div></div>
</blockquote></div>