<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Title content=""><meta name=Keywords content=""><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.gmail-p1, li.gmail-p1, div.gmail-p1
        {mso-style-name:gmail-p1;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.gmail-s1
        {mso-style-name:gmail-s1;}
p.m-8453235739752480281gmail-p1, li.m-8453235739752480281gmail-p1, div.m-8453235739752480281gmail-p1
        {mso-style-name:m_-8453235739752480281gmail-p1;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.m-8453235739752480281gmail-apple-converted-space
        {mso-style-name:m_-8453235739752480281gmail-apple-converted-space;}
span.m-8453235739752480281gmail-s1
        {mso-style-name:m_-8453235739752480281gmail-s1;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:595.0pt 842.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body bgcolor=white lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>One of the first rules of programming is to READ the error statement.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>You are obviously passing an array of the sorts to the if statement.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>When posting to NCL, it helps if you print out the meta data for the variables you are having trouble with (printVarSummary).<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>It is difficult for us to know what you are trying to do without a good explanation from you.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>/M<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Marston S. Ward, PhD<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Department of Earth Sciences<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>University of Gothenburg, Sweden<o:p></o:p></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"><span style='color:#0070C0'>marston.johnston@gu.se</span></a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>SkypeID: marston.johnston <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Phone: +46-31-7864901 <o:p></o:p></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!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<o:p></o:p></span></p></div><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></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'>Barry Lynn <barry.h.lynn@gmail.com><br><b>Date: </b>Friday, 8 September 2017 at 10:01<br><b>To: </b>Marston Johnston <shejo284@gmail.com><br><b>Cc: </b>ncl-talk <ncl-talk@ucar.edu><br><b>Subject: </b>Re: [ncl-talk] Wondering how to write this if statement<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Hi:<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thank you (but)...<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>It doesn't -- is there another "trick" we're leaving out?<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></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.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=gmail-p1><span class=gmail-s1>fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions</span><o:p></o:p></p><p class=gmail-p1><span class=gmail-s1>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 41 in file ./radar_2.ncl</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></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:<o:p></o:p></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 style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>As far as I can see that should work:<br>if(dbz.lt.0.0) then<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Dbz = dbz + 256.0<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>end if<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>/M<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Marston S. Ward, PhD</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Department of Earth Sciences</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>University of Gothenburg, Sweden</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>SkypeID: marston.johnston </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>Only the fruitful thing is true!</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman",serif;color:#0070C0'>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p></div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi:<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I am wondering how to properly write this if statement in NCL language.<o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=m-8453235739752480281gmail-p1><span class=m-8453235739752480281gmail-apple-converted-space>  </span><span class=m-8453235739752480281gmail-s1>if (dbz.lt.0)then</span><o:p></o:p></p><p class=m-8453235739752480281gmail-p1><span class=m-8453235739752480281gmail-apple-converted-space>   </span><span class=m-8453235739752480281gmail-s1>dbz = dbz + 256</span><o:p></o:p></p><p class=m-8453235739752480281gmail-p1><span class=m-8453235739752480281gmail-apple-converted-space>  </span><span class=m-8453235739752480281gmail-s1>end if</span><o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-- <o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Barry H. Lynn, Ph.D<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Senior Lecturer,<o:p></o:p></p></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'>The Institute of the Earth Science, <br>The Hebrew University of Jerusalem, <br>Givat Ram, Jerusalem 91904, Israel </span><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'>Tel: 972 547 231 170<br>Fax: (972)-25662581</span><o:p></o:p></p></div></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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><o:p></o:p></p></div></div></div></div></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>_______________________________________________ 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/mailman/listinfo/ncl-talk</a> <o:p></o:p></p></div></div></blockquote></div><p class=MsoNormal><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>-- <o:p></o:p></p><div><div><p class=MsoNormal>Barry H. Lynn, Ph.D<o:p></o:p></p><div><div><p class=MsoNormal>Senior Lecturer,<o:p></o:p></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><o:p></o:p></p></div><p class=MsoNormal><span style='color:#888888'>Tel: 972 547 231 170<br>Fax: (972)-25662581</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></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 914 432 3108<o:p></o:p></p></div></div></div></div></div></body></html>