<div dir="ltr"><div class="gmail_default"><div class="gmail_default">Barry,</div><div class="gmail_default"><br></div><div class="gmail_default">You have a couple of bugs in your code:</div><div class="gmail_default"><br></div><div class="gmail_default">First, I'm not sure if this is a bug, but you have:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace"> xlat_m = xlat2d_m(:,nx/2)</font></div><div class="gmail_default"><font face="monospace, monospace"> xlon_m = xlon2d_m(nx/2,:)</font></div><div class="gmail_default"><br></div><div class="gmail_default">I think you meant to do:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace"> xlat_m = xlat2d_m(:,nx/2)</font></div><div class="gmail_default"><font face="monospace, monospace"> xlon_m = xlon2d_m(ny/2,:) ; note the "ny/2"</font></div><div class="gmail_default"><br></div><div class="gmail_default">Second, and this is a very subtle bug, you have:</div><div class="gmail_default"><br></div><div class="gmail_default"> rscan = (/2, 1.0, 0.2/)</div><div class="gmail_default"> rscan = (/1/)</div><div class="gmail_default"><br></div><div class="gmail_default">What's happening is that you are first setting rscan to an array of three elements. Then, you set rscan to 1, but what this is doing is keeping the original array of three elements, and setting them all to 1. You are effectively passing rscan = (/1,1,1/) to the function, which apparently doesn't work. If you want rscan to be a scalar of value 1, you either need to use:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">rscan := 1 ; ":=" effectively removes the "old" rscan </font></div><div class="gmail_default"><font face="monospace, monospace"> ; and creates a new one with just 1 element.</font></div><div class="gmail_default"><br></div><div class="gmail_default">or simply comment out the first line:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">; rscan = (/2, 1.0, 0.2/)</font></div><div class="gmail_default"><br></div><div class="gmail_default">This is why clean code is so important! I didn't notice this bug at first until I completely stripped your code bare so that it only had the absolute required code I needed for doing the calculation. I noticed it started working when I did that, so I had to go back and see what was different between your code and the stripped down code. I've attached the stripped down code so you can see what this looks like. Note that I removed a bunch of "new" statements. You don't need these.</div><div class="gmail_default"><br></div><div class="gmail_default">When you have a bunch of commented out code, you have to be very careful that you are commenting out *everything* that you don't need, otherwise it becomes confusing what is actually happening in the script.</div><div class="gmail_default"><br></div><div class="gmail_default">If you continue to have problems with scripts, please send us *clean* scripts that we can easily look at. Otherwise, it's very time-consuming to go through all the commented and uncommented code to figure out what's happening.</div><div class="gmail_default"><br></div><div class="gmail_default">Thanks,</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 6, 2016 at 1:13 PM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</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"><span style="font-size:12.8px">Hi:</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am trying to interpolate station observations to a grid, but getting back all zeroes.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/obj_anal_ic_Wrap.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Contributed/obj_<wbr>anal_ic_Wrap.shtml</a></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have checked that the three arrays for lat, lon, and obs are filled, as well as the grid itself.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thank you for your suggestions.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Barry Lynn</div><div style="font-size:12.8px">P.S. I will add mapping functions next...</div><div style="font-size:12.8px">P.P.S: I cannot attach the xlat,xlon file, which are xlat and xlon files for the northeastern US because they are 4.5 MB, and 1.5 mb is the limit.</div><div><br></div>-- <br><div class="m_6643252913243953854gmail_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%203108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>