<div dir="ltr"><div><div>I forgot that I had a library of functions that use gradients. Maybe these will be useful for you. <br>See attached.<br><br>These were originally developed some time ago. I updated them to uses 6.5.0 new language feature: <b>elseif<br><br></b>I'm sure the 1st four functions work. I *think* the Q-vector functions work.<br></div>These functions could be quite useful for  investigating (say) cyclogenesis/<span class="gmail-st">frontogenesis.<br><br></span></div><span class="gmail-st">All require <b>rectilinear </b>(global or regional) grids. Documentation is embedded within the functions<br></span><div><span class="gmail-st"><br></span><b>advect_variable_cfd  </b>           : regional grid; centered finite difference<br></div><div>                                               ; This is a function that should have been in 6.5.0. My bad.<br></div><div><br><span class="gmail-st"><span class="gmail-st"><b>shear_stretch_deform</b>         ; kinematic; global; spherical harmonics<br></span></span><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><b>shear_stretch_deform_cfd</b>  ;     "                     ; regional; centered finite differences<br><br><b>beta_dfdy_rossby</b>                ; important in the studying the generation of Rossby waves.  <br></span></span></span><br><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><b>qvector_isobaric</b>                    ; Q-Vector on isobaric levels; global grid; spherical harmonics<br></span></span></span><b>qvector_isobaric_cfd</b>             ; Q-Vector on isobaric levels; regional grid; centered finite differences<br><br></span></span><b></b></span><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><br></span></span></span></span></div><div><span class="gmail-st"><span class="gmail-st"><span class="gmail-st"><span class="gmail-st">Cheers<br></span></span></span></span></div><div><b><span class="gmail-st"><span class="gmail-st"><b><span class="gmail-st"><span class="gmail-st"></span></span></b></span></span></b></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 16, 2018 at 7:58 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Gradients: zonal [ d()/dx ] and meridional [ d()/dy ]<br><br></div><div>[1] <br>WRF data are on a <span style="color:rgb(0,0,255)"><b>regional </b></span> <b>curvilinear</b> grid. <br><br>[2]<br>NCL's <span style="color:rgb(255,0,0)"><b>gradient calculation functions</b></span> require data to be on a <b>rectilinear</b> grid.<br><br></div>[3] <br> Different functions should be used for global and regional rectilinear grids.<br><br>For global grids, NCL's gradient calculation functions use <i>highly accurate</i> spherical harmonics to calculate gradients<br>For regional grids, NCL's gradient calculation functions use centered finite differences <br><br></div><div>[4]<br>NCL has no single function to directly calculate the zonal and meridional gradients on a curvilinear grid. <br><br>[5]<br></div><div>You must (a) interpolate the WRF data to a rectilinear grid of about the same resolution or, ?better? slightly higher resolution; (b) calculate the gradients on the rectilinear grid using <b><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/grad_latlon_cfd.shtml" target="_blank">grad_latlon_cfd</a></b>; (c) reinterpolate from the rectilinear grid back onto the original WRF grid.<br><br></div><div>[6] See:<br><a href="http://www.ncl.ucar.edu/Applications/ESMF.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/ESMF.shtml</a><br></div><div>Examples 29 and 37<br></div><div>Here, the divergence was calculated [ <b><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dv_cfd.shtml" target="_blank"><strong>uv2dv_cfd ] </strong></a></b><strong></strong>but you can use the<b><strong> grad_latlon_cfd </strong></b><strong></strong>function<b><strong>.<br></strong></b></div><div>==============================<wbr>==============================<wbr>=======<br><br><a href="http://www.ncl.ucar.edu/Applications/gradients.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/gradients.shtml</a><br><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/grad_latlon_cfd.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/<wbr>Contributed/grad_latlon_cfd.<wbr>shtml</a><br><br><br></div><div>FYI only: global <br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/gradsg.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>gradsg.shtml</a><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/gradsf.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>gradsf.shtml</a><br><br></div><div>HTH<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Aug 16, 2018 at 6:28 AM, Ty Buckingham <span dir="ltr"><<a href="mailto:ty.buckingham@manchester.ac.uk" target="_blank">ty.buckingham@manchester.ac.<wbr>uk</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hi all,
<div><br>
</div>
<div>I'm probably overthinking this, but I'm struggling isolating the d/dx and d/dy of a variable (in my case, absolute vorticity from WRF output).</div>
<div><br>
</div>
<div>Is there an easy way to compute this?</div>
<div><br>
</div>
<div>Thanks</div><span class="m_8175027091682385240HOEnZb"><font color="#888888">
<div>Ty</div>
</font></span></div>
</div>

<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>