<div dir="ltr">That is correct. You cannot currently select the levels that you want to interpolate to, it automatically selects them for you. The current documentation for the 'z' variable is incorrect. The 'z' array is not the levels that you want to interpolate to, it is the height values for each grid point in 'rh', since this information is not contained in the 'rh' variable. The algorithm uses the 'z' values to perform the interpolation of 'rh' at each level specified in z_var2d. Currently there is no way to specify your desired levels in z_var2d without the modifications shown previously. This will be addressed in a future release with a new vertical cross section routine.<div><br></div><div>I'll make a ticket to fix the documentation.</div><div><br></div><div>Thanks,</div><div><br></div><div>Bill</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 15, 2017 at 10:37 AM, Trostel, John M. <span dir="ltr"><<a href="mailto:john.trostel@gtri.gatech.edu" target="_blank">john.trostel@gtri.gatech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div id="m_819766877980743783divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p>My hack does essentially what you describe below. <br>
</p>
<p><br>
</p>
<p>However, in the current code, even when one has a points at the defined Z-array, the current code (as you show below) ignores them and simply interpolates over 100 equally spaced points.<br>
</p><span class="">
<p><br>
</p>
<div id="m_819766877980743783Signature">
<div name="divtagdefaultwrapper">
--
<div>John Trostel<br>
Director - Severe Storms Research Center<br>
Georgia Tech Research Institute<br>
Atlanta, GA 30332-0857</div>
</div>
</div>
</span></div>
<hr style="display:inline-block;width:98%">
<div id="m_819766877980743783divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Bill Ladwig <<a href="mailto:ladwig@ucar.edu" target="_blank">ladwig@ucar.edu</a>><br>
<b>Sent:</b> Friday, December 15, 2017 12:30:37 PM<br>
<b>To:</b> Trostel, John M.<br>
<b>Cc:</b> Barry Lynn; <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><div><div class="h5"><br>
<b>Subject:</b> Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels</div></div></font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">The current cross section implementation in NCL does not allow the user to select the levels to interpolate to. The 'z' argument is not the levels that you want, it's the height coordinate value for each grid point (either pressure or geopotential
height). In a future release, we will be creating a new vertical cross section function that has the same capabilities as wrf-python (which does have the capability you want). For now, if you want to modify your WRFUserARW.ncl to specify the levels that
you want, you need to modify this (around line 371):
<div><br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
;<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">interp</span> to constant z grid<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>if(var2dz(0,0) .<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">gt</span>. var2dz(1,0) ) then<span class="m_819766877980743783gmail-Apple-converted-space">
</span>; monotonically decreasing coordinate<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_max = floor(max(z)/10)*10
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>; bottom value<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_min = <span class="m_819766877980743783gmail-s1" style="text-decoration:underline">
ceil</span>(<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">min</span>(z)/10)*10<span class="m_819766877980743783gmail-Apple-converted-space">
</span>; top value<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz</span> = 10<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">nlevels</span> =
<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">tointeger</span>( (z_max-z_min)/<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz</span>)<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_var2d = new( (/<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">nlevels</span>/),
<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">typeof</span>(z))<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_var2d(0) = z_max<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz</span> = -<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz<br>
</span><span class="m_819766877980743783gmail-Apple-converted-space"> </span>else<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_max = max(z)<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_min = 0.<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz</span> = 0.01 * z_max<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span><span class="m_819766877980743783gmail-s1" style="text-decoration:underline">nlevels</span> =
<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">tointeger</span>( z_max/<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz</span> )<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_var2d = new( (/<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">nlevels</span>/),
<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">typeof</span>(z))<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_var2d(0) = z_min<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>end if<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> <br>
</span><span class="m_819766877980743783gmail-Apple-converted-space"> </span>do i=1, <span class="m_819766877980743783gmail-s1" style="text-decoration:underline">
nlevels</span>-1<br>
<span class="m_819766877980743783gmail-Apple-converted-space"> </span>z_var2d(i) = z_var2d(0)+i*<span class="m_819766877980743783gmail-s1" style="text-decoration:underline">dz<br>
</span><span class="m_819766877980743783gmail-Apple-converted-space"> </span>end do</blockquote>
<div><br>
</div>
<div>Set z_var2d to be the levels that you want and comment out the rest. If you don't want to modify the original WRFUserARW.ncl code, then copy wrf_user_intrp3d to a new file (and either change the function name or remember to call undef("wrf_user_intrp3d")
before the function definition) and use a load statement at the top of your script. </div>
<div><br>
</div>
<div>Hope this helps,</div>
<div><br>
</div>
<div>Bill</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Dec 15, 2017 at 7:31 AM, Trostel, John M. <span dir="ltr">
<<a href="mailto:john.trostel@gtri.gatech.edu" target="_blank">john.trostel@gtri.gatech.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 id="m_819766877980743783m_-6281168637419133920divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">This should have read:</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">When using the function to produce a cross section ALONG A RADIAL IN THE X/Y PLANE...</span><br>
</p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></p>
<p><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Sorry for any confusion.</span></p>
<span>
<p><br>
</p>
<div id="m_819766877980743783m_-6281168637419133920Signature">
<div name="divtagdefaultwrapper">--
<div>John Trostel<br>
Director - Severe Storms Research Center<br>
Georgia Tech Research Institute<br>
Atlanta, GA 30332-0857</div>
</div>
</div>
</span></div>
<hr style="display:inline-block;width:98%">
<div id="m_819766877980743783m_-6281168637419133920divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> ncl-talk <<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>> on behalf of Trostel,
John M. <<a href="mailto:john.trostel@gtri.gatech.edu" target="_blank">john.trostel@gtri.gatech.edu</a>><br>
<b>Sent:</b> Friday, December 15, 2017 9:23:39 AM<br>
<b>To:</b> Barry Lynn
<div>
<div class="m_819766877980743783h5"><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels</div>
</div>
</font>
<div> </div>
</div>
<div>
<div class="m_819766877980743783h5">
<div>
<div id="m_819766877980743783m_-6281168637419133920divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<div id="m_819766877980743783m_-6281168637419133920divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p>When using the function to produce a cross section, the plane is oriented in the vertical direction. One of the inputs is a height/z array. The code ignores all but the min/max of this array and just interpolates to 100 evenly spaced points in this vertical
plane.</p>
<p><br>
</p>
<p>I have a very inelegant hack of the function working in my custom version of WRFUserARW.ncl. In the hacked version, the input z array is used to produce the vertical dimension of the output. The interpolation, is purely in the horizontal plane.</p>
<p><br>
</p>
<p>If the function is used to produce a vertical plane, the interpolation is, as you mentioned, to that constant height.</p>
<p><br>
</p>
<div id="m_819766877980743783m_-6281168637419133920Signature">
<div name="divtagdefaultwrapper">--
<div>John Trostel<br>
Director - Severe Storms Research Center<br>
Georgia Tech Research Institute<br>
Atlanta, GA 30332-0857</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_819766877980743783m_-6281168637419133920divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>><br>
<b>Sent:</b> Friday, December 15, 2017 3:21:29 AM<br>
<b>To:</b> Trostel, John M.<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels</font>
<div> </div>
</div>
<div>
<div dir="ltr">Dear John:
<div><br>
</div>
<div>I am not sure I follow what you are trying to do, but plane should be a single number, like the height you want to interpolate to (in m, if z is in m).</div>
<div><br>
</div>
<div>Barry</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Dec 14, 2017 at 11:24 PM, Trostel, John M. <span dir="ltr">
<<a href="mailto:john.trostel@gtri.gatech.edu" target="_blank">john.trostel@gtri.gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_819766877980743783m_-6281168637419133920m_-8142398721557378008WordSection1">
<p class="MsoNormal">I have been trying to use the function “wrf_user_intrp3d” and assumed it would work like the NCL documentation suggests.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Function wrf_user_intrp3d (var3d, vert, plot_type, loc, angle, logical)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am calling it as follows:<u></u><u></u></p>
<p class="MsoNormal"> rh_plane = wrf_user_intrp3d(rh,z,"v",plan<wbr>e,0.,opts)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">where rh is my relative humidity variable from wrfout (at time “it)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">rh = wrf_user_getvar(a,"rh",it) <wbr> ; relative humidity<u></u><u></u></p>
<p class="MsoNormal">and z is my model heights<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">z = wrf_user_getvar(a, "z",it) ; grid point height<u></u><u></u></p>
<p class="MsoNormal">plane is defined as follows:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-indent:.5in">; Find the ij location for the Test Site (remains constant)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">test_lat = 35.0<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">test_lon = -85.7<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">llres = True<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">llres@ReturnInt = True ; Return integer values<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">locij = wrf_user_ll_to_ij(a, test_lon, test_lat, llres)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">locij = locij - 1 ; array pointers in NCL space<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">TestX = locij(0)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">TestY = locij(1)<u></u><u></u></p>
<p class="MsoNormal">; print("TestX (" + test_lat + "): " + TestX)<u></u><u></u></p>
<p class="MsoNormal">; print("TestY (" + test_lon + "): " + TestY)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-indent:.5in">; Find the ij location for the end point (change for different arcs)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">end_lat = 34.0<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">end_lon = -85.5<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">llres = True<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">llres@ReturnInt = True ; Return integer values<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">locij = wrf_user_ll_to_ij(a, end_lon, end_lat, llres)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">locij = locij - 1 ; array pointers in NCL space<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">EndX = locij(0)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">EndY = locij(1)<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in"><u></u> <u></u></p>
<p class="MsoNormal"> plane = new(4,float)<u></u><u></u></p>
<p class="MsoNormal"> plane = (/ TestX, TestY, EndX, EndY /) ; start x;y & end x;y point<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">and, finally<u></u><u></u></p>
<p class="MsoNormal"> opts=True<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I would expect to get back rh_plane values along the radial of the defined “plane” at the heights specified in z. In this case, I defined 50 heights for WRF, so I have a nZ of 50 for the z/interpolation variable. I was baffled when I
got back 100 rh_plane values in the vertical. Looking through the source code for wrf_user_intrp3d (finally), I found that the function is just interpolating to a uniform 100 levels between the min and max Z values.<u></u><u></u></p>
<p class="MsoNormal"> z_max = max(z)<u></u><u></u></p>
<p class="MsoNormal"> z_min = 0.<u></u><u></u></p>
<p class="MsoNormal"> dz = 0.01 * z_max<u></u><u></u></p>
<p class="MsoNormal"> nlevels = tointeger( zmax/dz )<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Why doesn’t the routine use the levels that the user has input into the function?<u></u><u></u></p>
<p class="MsoNormal">Is there an improved wrf_user_intrp3d function? (Can I fix it and recompile it easily?)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">--<u></u><u></u></p>
<p class="MsoNormal">John Trostel<u></u><u></u></p>
<p class="MsoNormal">Director – Severe Storms Research Center<u></u><u></u></p>
<p class="MsoNormal">Georgia Tech Research Institute<u></u><u></u></p>
<p class="MsoNormal">Atlanta, GA 30332-0857<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>
______________________________<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>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="m_819766877980743783m_-6281168637419133920gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">Barry H. Lynn, Ph.D
<div>
<div>Senior Lecturer,</div>
<div>
<div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)">
<span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)">
<span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)">
</div>
<span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)">
<span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div>
</div>
<div><span style="color:rgb(136,136,136)"><br>
</span></div>
<div>C.E.O, Weather It Is, LTD<br>
Weather and Climate Focus<br>
<a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>
Jerusalem, Israel<br>
Local: 02 930 9525<br>
Cell: 054 7 231 170<br>
Int-IS: x972 2 930 9525<br>
US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
______________________________<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>
</div>
</div></div></div>
</blockquote></div><br></div>