<div dir="ltr">I think I explained the top/bottom a little off, but the equation is there. Not really a forward difference. Sorry for any confusion. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 27, 2022 at 12:02 PM Joseph Clark <<a href="mailto:jpclark186000@gmail.com">jpclark186000@gmail.com</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">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 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-m_-5377753779698577554gmail-LC74" 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-wrap"> dplvl(<span style="box-sizing:border-box">1</span>) <span style="box-sizing:border-box">=</span> (plvl(<span style="box-sizing:border-box">1</span>)<span style="box-sizing:border-box">+</span>plvl(<span style="box-sizing:border-box">2</span>))<span style="box-sizing:border-box">*</span><span style="box-sizing:border-box">0.5d0</span> <span style="box-sizing:border-box">-</span> ptop
<span style="box-sizing:border-box"> do</span> kl<span style="box-sizing:border-box">=</span><span style="box-sizing:border-box">2</span>,klvl<span style="box-sizing:border-box">-1</span>
dplvl(kl)<span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">0.5d0</span><span style="box-sizing:border-box">*</span>(plvl(kl<span style="box-sizing:border-box">+1</span>) <span style="box-sizing:border-box">-</span> plvl(kl<span style="box-sizing:border-box">-1</span>))
<span style="box-sizing:border-box"> end do
</span> dplvl(klvl) <span style="box-sizing:border-box">=</span> psfcmx <span style="box-sizing:border-box">-</span>(plvl(klvl)<span style="box-sizing:border-box">+</span>plvl(klvl<span style="box-sizing:border-box">-1</span>))<span style="box-sizing:border-box">*</span><span style="box-sizing:border-box">0.5d0</span>
</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_-5377753779698577554gmail-L75" 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-m_-5377753779698577554gmail-LC75" 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-wrap"><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" target="_blank">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>
</blockquote></div>