<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">You can't convert fractional digit numbers to byte (see here <a href="https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml" class="">https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml</a>). You would have to convert eveything to float (or double) and then compare again.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8. Sep 2017, at 10:51, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" class="">barry.h.lynn@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">So, then I need to convert 0.5 and 0.33 to byte values, I assume -- regarding my last question.<div class=""><br class=""></div><div class="">Thank you for clarifying.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Sep 8, 2017 at 11:48 AM, Guido Cioni <span dir="ltr" class=""><<a href="mailto:guidocioni@gmail.com" target="_blank" class="">guidocioni@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">dbz is byte type -> wrap_around thus is byte type.<div class=""><br class=""></div><div class="">256. will be a floating point variable. In fortran, and thus NCL, if you write 256 you will get an integer variable, 256. (with the point) a float variable.</div><div class=""><br class=""></div><div class="">Thus when making wrap_around=256. you are forcing an assignment between byte and float type, which NCL cannot do without spitting out a warning or and error. Imagine if this would happen without noticing...it could lead to all sort of weird errors.</div><div class=""><br class=""></div><div class="">You have to convert wrap_around to float (for example with the function tofloat) before attempting that.</div><div class="">Cheers </div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="h5"><div class="">On 8. Sep 2017, at 10:11, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank" class="">barry.h.lynn@gmail.com</a>> wrote:</div><br class="m_-6885759330790536323Apple-interchange-newline"></div></div><div class=""><div class=""><div class="h5"><div dir="ltr" class="">Hi:<div class=""><br class=""></div><div class="">I have some simple code, copied below.</div><div class=""><br class=""></div><div class="">I cannot add the value of 256 to dbz or the value of wrap_around after</div><div class="">setting it to 256.</div><div class=""><br class=""></div><div class=""><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>wrap_around = </span><span class="m_-6885759330790536323gmail-s2">dbz</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>wrap_around = 256.</span></p><p class="m_-6885759330790536323gmail-p2"><span class="m_-6885759330790536323gmail-s1"></span><br class=""></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>do j = 0,dims2d(0)-1</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>do i = 0,dims2d(1)-1</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>check = ismissing(</span><span class="m_-6885759330790536323gmail-s2">dbz</span><span class="m_-6885759330790536323gmail-s1">(j,i))</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>if (check.eq.False)then</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>if (</span><span class="m_-6885759330790536323gmail-s2">dbz</span><span class="m_-6885759330790536323gmail-s1">(j,i).lt.0)then</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"> </span><span class="m_-6885759330790536323gmail-s2">dbz</span><span class="m_-6885759330790536323gmail-s1">(j,i) = </span><span class="m_-6885759330790536323gmail-s2">dbz</span><span class="m_-6885759330790536323gmail-s1">(j,i) + wrap_around(j,i)</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>end if</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>end if</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>end do</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>end do</span></p></div><div class=""><br class=""></div><div class=""><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">fatal:["NclVar.c":1390]:<wbr class="">Assignment type mismatch, right hand side can't be coerced to type of left hand side</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">fatal:["Execute.c":8575]:<wbr class="">Execute: Error occurred at or near line 35 in file ./ra</span></p><div class="">PrintVarSummary gives:</div><div class=""><br class=""></div><div class=""><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Variable: dbz</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Type: byte</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Total Size: 480960 bytes</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>480960 values</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Number of Dimensions: 2</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Dimensions and sizes:<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>[radialR | 360] x [gateR | 1336]</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Coordinates:<span class="m_-6885759330790536323gmail-Apple-converted-space"> </span></span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1">Number Of Attributes: 14</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>units :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>dBz</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>long_name :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>Reflectivity</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>missing_value :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>0</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>signal_below_threshold :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>0</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>scale_factor :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>0.5</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>add_offset :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>-33</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>_Unsigned :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>true</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>range_folding_threshold :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>50</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>_CoordinateAxes :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>timeR elevationR azimuthR distanceR</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>scale_factor_metadata :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>0.5</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>add_offset_metadata :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>-33</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>range_folded_value_packed :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>1</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>range_folded_value :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>-32.5</span></p><p class="m_-6885759330790536323gmail-p1"><span class="m_-6885759330790536323gmail-s1"><span class="m_-6885759330790536323gmail-Apple-converted-space"> </span>_FillValue :<span class="m_-6885759330790536323gmail-Apple-tab-span"> </span>0</span></p></div>-- <br class=""><div class="m_-6885759330790536323gmail_signature"><div dir="ltr" class="">Barry H. Lynn, Ph.D<div class=""><div class="">Senior Lecturer,</div><div class=""><div class=""><span style="color:rgb(136,136,136)" class="">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)" class=""></div><span style="color:rgb(136,136,136)" class="">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Fax: (972)-25662581</span></div></div><div class=""><span style="color:rgb(136,136,136)" class=""><br class=""></span></div><div class="">C.E.O, Weather It Is, LTD<br class="">Weather and Climate Focus<br class=""><a href="http://weather-it-is.com/" target="_blank" class="">http://weather-it-is.com</a><br class="">Jerusalem, Israel<br class="">Local: 02 930 9525<br class="">Cell: 054 7 231 170<br class="">Int-IS: x972 2 930 9525<br class="">US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank" class="">914 432 3108</a><br class=""></div></div></div>
</div></div></div></div>
______________________________<wbr class="">_________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class=""><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" class="">http://mailman.ucar.edu/<wbr class="">mailman/listinfo/ncl-talk</a><span class="HOEnZb"><font color="#888888" class=""><br class=""></font></span></div></blockquote></div><span class="HOEnZb"><font color="#888888" class=""><br class=""><div class="">
<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><br class="m_-6885759330790536323Apple-interchange-newline">Guido Cioni</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="http://guidocioni.altervista/" target="_blank" class="">http://guidocioni.altervista</a>.<wbr class="">org</div>
</div>
<br class=""></font></span></div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Barry H. Lynn, Ph.D<div class=""><div class="">Senior Lecturer,</div><div class=""><div class=""><span style="color:rgb(136,136,136)" class="">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)" class=""></div><span style="color:rgb(136,136,136)" class="">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Fax: (972)-25662581</span></div></div><div class=""><span style="color:rgb(136,136,136)" class=""><br class=""></span></div><div class="">C.E.O, Weather It Is, LTD<br class="">Weather and Climate Focus<br class=""><a href="http://weather-it-is.com/" target="_blank" class="">http://weather-it-is.com</a><br class="">Jerusalem, Israel<br class="">Local: 02 930 9525<br class="">Cell: 054 7 231 170<br class="">Int-IS: x972 2 930 9525<br class="">US 914 432 3108<br class=""></div></div></div>
</div>
</div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">Guido Cioni</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://guidocioni.altervista" class="">http://guidocioni.altervista</a>.org</div>
</div>
<br class=""></div></body></html>