<div dir="ltr">Hi:<div><br></div><div>I am not sure of all the steps, but small numbers are not NaNs.  Perhaps you are dividing by close to zero, when you should limit to a number reasonably above?</div><div><br></div><div>Is that possible to do?</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018 at 2:40 PM Sri Nandini <<a href="mailto:snandini@marum.de">snandini@marum.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div><br></div><div>Yes.</div><div><br></div><div>1) I use geopotential height and the values were originally like this: 1080.752</div><div><br></div><div>   T41    = f->Z3(:,{850},:,:)<br><br>   printVarSummary(T41)                        ; [Time|12]x [lat | 96] x [lon | 144]<br>   T41@_FillValue = -9.96921e+36  <br>   print(T41)</div><div><br></div><div><br></div><div>2) Then i performed: dim_avg_n_Wrap and values were like: 0.0009252814</div><div><br></div><div>    aveX    = dim_avg_n_Wrap(T41,0)  <br>   printVarSummary(aveX)                      ; (lat,lon)</div><div><br></div><div>   aveX@_FillValue =9.96921e+36  <br>   print(where(aveX.ne.0, aveX, aveX@_FillValue))</div><div><br></div><div> values like this:  1080.752</div><div><br></div><div>   aveX = 1. / where(aveX.ne.0, aveX, aveX@_FillValue) <br>   print(aveX)</div><div><br></div><div>0.0009252814</div><div><br></div><div>3) I use this in the eady growth rate equation and that gives me nan values for few gridpoints.</div><div>   egr = eady_growth_rate(aveX2, aveX1, aveX, XLAT, 0,  1)<br>   printVarSummary(egr)<br><br>   printMinMax(egr,0)<br><br>Variable: egr<br>Type: double<br>Total Size: 110592 bytes<br>            13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes:    [lat | 96] x [lon | 144]<br>Coordinates: <br>            lat: [ -90..  90]<br>            lon: [   0..357.5]<br>Number Of Attributes: 3<br>  _FillValue :    9.969209968386869e+36<br>  long_name :    maximum eady growth rate<br>  units :    <br>(0)    maximum eady growth rate : min=nan   max=nan<br></div><div><br></div><div>4) All the inputs into the eady growth rate equation have data points but some are almost zeros, as such i assume it gets masked out to nan?<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>On Aug 22, 2018 12:15:37 PM, Barry Lynn wrote:
</div><blockquote class="m_-8288107572240878405felamimail-body-blockquote"><div dir="ltr">Hi:<div><br></div><div>Are the points that actually have data producing NaNs from the calculations?</div><div><br></div><div>Barry</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018 at 12:56 PM Sri Nandini <<a href="mailto:snandini@marum.de" target="_blank">snandini@marum.de</a>> wrote:<br></div><blockquote class="m_-8288107572240878405felamimail-body-blockquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div><br></div><div>Thank you</div><div><br></div><div>I used it and have seen that i have data points except some gridpoints which point to nan and the fillvalue both.</div><div>I think then there is no data over these points.<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>On Aug 22, 2018 10:46:56 AM, Barry Lynn wrote:
</div><blockquote class="m_-8288107572240878405felamimail-body-blockquote"><div dir="ltr">Hello Sri:<div><br></div><div>I would try it this way.</div><div><br></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">Set </span><em style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">y</em><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"> to a _FillValue value where it is equal to 0, and then can do the divide:</span></div><div><span style="color:#333333;font-family:verdana,sans-serif"><span style="font-size:13.3333px">   y</span></span><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">@_FillValue = 1.E36 ; or something like this.</span></div><div><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">   print(where(y.ne.0,y,</span><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">@_FillValue)) ;  I am assuming this works. </span></div><div><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">If nothing prints then maybe you have no values. </span></div><div><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">In any case, try the next two lines. </span></div><div><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">   y    = </span><strong style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em;margin:0px;padding:0px">where</strong><span style="color:rgb(51,51,51);font-family:courier;font-size:13.3333px;text-indent:0em">(y.ne.0,y,y@_FillValue)</span><br><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;text-indent:0em;color:rgb(51,51,51)">  yinv = 1. / y</pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;text-indent:0em;color:rgb(51,51,51)">However, just to check, I would </pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;text-indent:0em;color:rgb(51,51,51)"><br></pre></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018 at 11:39 AM Sri Nandini <<a href="mailto:snandini@marum.de" target="_blank">snandini@marum.de</a>> wrote:<br></div><blockquote class="m_-8288107572240878405felamimail-body-blockquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello <br><br>
how can I remove the zero values to avoid dividing by zero the error I got is as the following:<br><br>
 fatal:divide: Division by 0, Can't continue<br>
 fatal:Div: operator failed, can't continue <br><br>
I have tried using   yinv = 1. / where(y.ne.0, y, y@_FillValue) but now it gives me all nan values<br><br>
Heres the bit of my code<br><br>
   T41    = f->Z3(:,{850},:,:)<br><br>
   printVarSummary(T41)    <br>
   T41@_FillValue = -9.96921e+36  <br><br>
   aveX    = dim_avg_n_Wrap(T41,0)  <br>
   printVarSummary(aveX)                      ; (lat,lon)<br>
   T41@_FillValue = -9.96921e+36 <br><br>
   aveX = 1. / where(aveX.ne.0, aveX, aveX@_FillValue) <br><br>
aveX1 and aveX2 below are of same type as aveX.<br>
   XLAT = conform ( aveX2 , xlat , 0 ) <br>
   printVarSummary(XLAT)<br><br>
   egr = eady_growth_rate(aveX2, aveX1, aveX, XLAT, 0,  1)<br><br>
Output<br>
===========================<br>
Variable: egr<br>
Type: double<br>
Total Size: 110592 bytes<br>
            13824 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes:   [lat | 96] x [lon | 144]<br>
Coordinates: <br>
            lat: [ -90..  90]<br>
            lon: [   0..357.5]<br>
Number Of Attributes: 3<br>
  _FillValue :  -9.969209968386869e+36<br>
  long_name :   maximum eady growth rate<br>
  units :       <br>
(0)     maximum eady growth rate : min=nan   max=nan<br><br><br>
Any advice is much appreciated<br>
_______________________________________________<br>
ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br></blockquote></div><br style="clear:both"><div><br></div>-- <br><div dir="ltr" class="m_-8288107572240878405m_9088751585779618685gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, 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><br></div></div></div></div></div>
</blockquote><br></div>
</blockquote></div><br style="clear:both"><div><br></div>-- <br><div dir="ltr" class="m_-8288107572240878405gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, 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><br></div></div></div></div></div>
</blockquote><br></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, 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><br></div></div></div></div></div>