<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><font color="#333333" face="verdana, sans-serif"><span style="font-size:13.3333px"> y</span></font><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">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">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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</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>