<div dir="ltr">Hi:<div><br></div><div>My apologies for not making that clear, but I thought it was obvious that the if statement was comparing array values.</div><div><br></div><div>I am hoping there is a more direct way to do this comparison than doing a loop, index by index.</div><div><br></div><div>Thank you helping to clarify the programming issues. Much appreciated.</div><div><br></div><div>Barry</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 8, 2017 at 11:32 AM, Marston Johnston <span dir="ltr"><<a href="mailto:shejo284@gmail.com" target="_blank">shejo284@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 bgcolor="white" lang="EN-GB" link="blue" vlink="purple"><div class="m_2371980543583632511WordSection1"><p class="MsoNormal"><span>Hi,<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>One of the first rules of programming is to READ the error statement.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>In your case there is nothing wrong with the IF statement per se. The problem is that you do not understand what you are asking the IF statement to do. As you have written it, the IF statement needs a scalar (single value) or a boolean logical (true or false) in order to get the correct execution.<u></u><u></u></span></p><p class="MsoNormal"><span>You are obviously passing an array of the sorts to the if statement.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>When posting to NCL, it helps if you print out the meta data for the variables you are having trouble with (printVarSummary).<u></u><u></u></span></p><p class="MsoNormal"><span>When checking the elements of an array you need to loop over the elements 1 at a time – if that is what you are trying to do.<u></u><u></u></span></p><p class="MsoNormal"><span>It is difficult for us to know what you are trying to do without a good explanation from you.<u></u><u></u></span></p><span class=""><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>/M<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Marston S. Ward, PhD<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Department of Earth Sciences<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">University of Gothenburg, Sweden<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Email: <a href="mailto:marston.johnston@gu.se" target="_blank"><span style="color:#0070c0">marston.johnston@gu.se</span></a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">SkypeID: marston.johnston <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Phone: <a href="tel:+46%2031%20786%2049%2001" value="+46317864901" target="_blank">+46-31-7864901</a> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Only the fruitful thing is true!<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></p></div><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p></span><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>><br><b>Date: </b>Friday, 8 September 2017 at 10:01<br><b>To: </b>Marston Johnston <<a href="mailto:shejo284@gmail.com" target="_blank">shejo284@gmail.com</a>><br><b>Cc: </b>ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br><b>Subject: </b>Re: [ncl-talk] Wondering how to write this if statement<u></u><u></u></span></p></div><div><div class="h5"><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Hi:<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thank you (but)...<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">It doesn't -- is there another "trick" we're leaving out?<u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I think there is another way to write it where you condition it, rathern than use an if statement.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="m_2371980543583632511gmail-p1"><span class="m_2371980543583632511gmail-s1">fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions</span><u></u><u></u></p><p class="m_2371980543583632511gmail-p1"><span class="m_2371980543583632511gmail-s1">fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 41 in file ./radar_2.ncl</span><u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Fri, Sep 8, 2017 at 10:35 AM, Marston Johnston <<a href="mailto:shejo284@gmail.com" target="_blank">shejo284@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">As far as I can see that should work:<br>if(dbz.lt.0.0) then<u></u><u></u></p><p class="MsoNormal">Dbz = dbz + 256.0<u></u><u></u></p><p class="MsoNormal">end if<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">/M<u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Marston S. Ward, PhD</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Department of Earth Sciences</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">University of Gothenburg, Sweden</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Email: <a href="mailto:marston.johnston@gu.se" target="_blank"><span style="color:#0070c0">marston.johnston@gu.se</span></a></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">SkypeID: marston.johnston </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Phone: <a href="tel:+46%2031%20786%2049%2001" target="_blank">+46-31-7864901</a> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">Only the fruitful thing is true!</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070c0">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><u></u><u></u></p></div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">ncl-talk <<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>> on behalf of Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>><br><b>Date: </b>Friday, 8 September 2017 at 09:33<br><b>To: </b>ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br><b>Subject: </b>[ncl-talk] Wondering how to write this if statement</span><u></u><u></u></p></div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Hi:<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">I am wondering how to properly write this if statement in NCL language.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="m_2371980543583632511m-8453235739752480281gmail-p1"><span class="m_2371980543583632511m-8453235739752480281gmail-apple-converted-space"> </span><span class="m_2371980543583632511m-8453235739752480281gmail-s1">if (dbz.lt.0)then</span><u></u><u></u></p><p class="m_2371980543583632511m-8453235739752480281gmail-p1"><span class="m_2371980543583632511m-8453235739752480281gmail-apple-converted-space"> </span><span class="m_2371980543583632511m-8453235739752480281gmail-s1">dbz = dbz + 256</span><u></u><u></u></p><p class="m_2371980543583632511m-8453235739752480281gmail-p1"><span class="m_2371980543583632511m-8453235739752480281gmail-apple-converted-space"> </span><span class="m_2371980543583632511m-8453235739752480281gmail-s1">end if</span><u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal">Barry H. Lynn, Ph.D<u></u><u></u></p><div><div><p class="MsoNormal">Senior Lecturer,<u></u><u></u></p></div><div><div><p class="MsoNormal"><span style="color:#888888">The Institute of the Earth Science, <br>The Hebrew University of Jerusalem, <br>Givat Ram, Jerusalem 91904, Israel </span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:#888888">Tel: 972 547 231 170<br>Fax: (972)-25662581</span><u></u><u></u></p></div></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">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" target="_blank">914 432 3108</a><u></u><u></u></p></div></div></div></div></div></div></div><p class="MsoNormal">______________________________<wbr>_________________ ncl-talk mailing list <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> List instructions, subscriber options, unsubscribe: <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a> <u></u><u></u></p></div></div></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal">Barry H. Lynn, Ph.D<u></u><u></u></p><div><div><p class="MsoNormal">Senior Lecturer,<u></u><u></u></p></div><div><div><p class="MsoNormal"><span style="color:#888888">The Institute of the Earth Science, <br>The Hebrew University of Jerusalem, <br>Givat Ram, Jerusalem 91904, Israel </span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:#888888">Tel: 972 547 231 170<br>Fax: (972)-25662581</span><u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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><u></u><u></u></p></div></div></div></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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 914 432 3108<br></div></div></div>
</div>