<div dir="ltr">The where statement did the trick for <i>that</i> problem -- thank you.<div><br></div><div><p class="MsoNormal" style="font-size:12.8px">If you want to check the elements of an array of any dimension and replace that element with a scalar of the same type, then consider the where()<u></u><u></u></p><p class="MsoNormal" style="font-size:12.8px">Statement:<u></u><u></u></p><p class="MsoNormal" style="font-size:12.8px"><u></u> <u></u></p><p class="MsoNormal" style="font-size:12.8px">Dbz = where(dbz.lt.0.0, dbz+256.0,dbz)<u></u><u></u></p><p class="MsoNormal" style="font-size:12.8px"><br></p><p class="MsoNormal" style="font-size:12.8px">Is there a similar approach for adding two numbers to the array?</p><p class="MsoNormal" style="font-size:12.8px"><br></p><p class="MsoNormal" style="font-size:12.8px">
</p><p class="gmail-p1"><span class="gmail-s1">dbz</span><span class="gmail-s2"> = </span><span class="gmail-s1">dbz</span><span class="gmail-s2">*0.5 - 0.33</span></p><p class="MsoNormal" style="font-size:12.8px"><u></u> </p><span class="gmail-im" style="font-size:12.8px">Thanks -- this should be the last of my questions abou this.<br><p class="MsoNormal"><br></p></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 8, 2017 at 11:46 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_7070590085487412997WordSection1"><p class="MsoNormal"><span>Try the where() statement and then printout the meta data on all variables involved in the problem.<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:44<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 Why I Get This Error<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">Of course I read the error statement.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I don't understand why I can add dbz (which is a 2 dimensional array) to a scalar value. This is a pretty basic thing to do.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Moreover, when I defined "wrap_around" as dbz, and then set wrap_around to zero, I still can't coerce the variables.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-s1">fatal:["NclVar.c":1390]:<wbr>Assignment type mismatch, right hand side can't be coerced to type of left hand side</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-s1">fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 35 in file ./radar_2.ncl</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-s1">Is the answer to this problem obvious? It seems to me that it should be, which I am (at the moment) frustrated. </span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><u></u> <u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">wrap_around = </span><span class="m_7070590085487412997gmail-s2">dbz</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">wrap_around = 256.</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p2"><u></u> <u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">do j = 0,dims2d(0)-1</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">do i = 0,dims2d(1)-1</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">check = ismissing(</span><span class="m_7070590085487412997gmail-s2">dbz</span><span class="m_7070590085487412997gmail-s1">(j,i))</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">if (check.eq.False)then</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">if (</span><span class="m_7070590085487412997gmail-s2">dbz</span><span class="m_7070590085487412997gmail-s1">(j,i).lt.0)then</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s2">dbz</span><span class="m_7070590085487412997gmail-s1">(j,i) = </span><span class="m_7070590085487412997gmail-s2">dbz</span><span class="m_7070590085487412997gmail-s1">(j,i) + wrap_around(j,i)</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">end if</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">end if</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">end do</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><span class="m_7070590085487412997gmail-apple-converted-space"> </span><span class="m_7070590085487412997gmail-s1">end do</span><u></u><u></u></p><p class="m_7070590085487412997gmail-p1"><u></u> <u></u></p></div><div><p class="MsoNormal"><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 11:37 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">Again, read the error statement and try to understand what it is telling you:<br><br>atal:["NclVar.c":1390]:<wbr>Assignment type mismatch, right hand side can't be coerced to type of left hand side<u></u><u></u></p><p class="MsoNormal">fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 35 in file ./ra<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">You have a TYPE mismatch between your variables and NCL cannot coerce one to the other. Make sure you are adding the same types of variables…<u></u><u></u></p><p class="MsoNormal">For example, you cannot do 1 + “help”, that would be a type mismatch!<u></u><u></u></p><p class="MsoNormal">/M<u></u><u></u></p><p class="MsoNormal"> <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 10:11<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 Why I Get This Error</span><u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><p class="m_7070590085487412997m-55610706163436350gmail-p1" style="font-variant-caps:normal;text-align:start;word-spacing:0px"><span class="m_7070590085487412997m-55610706163436350gmail-s1"><span style="font-family:"-webkit-standard",serif;color:black">atal:["NclVar.c":1390]:<wbr>Assignment type mismatch, right hand side can't be coerced to type of left hand side</span></span><u></u><u></u></p><p class="m_7070590085487412997m-55610706163436350gmail-p1" style="font-variant-caps:normal;text-align:start;word-spacing:0px"><span class="m_7070590085487412997m-55610706163436350gmail-s1"><span style="font-family:"-webkit-standard",serif;color:black">fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or near line 35 in file ./ra</span></span><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>