<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title><style type="text/css">.felamimail-body-blockquote {margin: 5px 10px 0 3px;padding-left: 10px;border-left: 2px solid #000088;} </style></head><body><div><br></div><div><br></div><div>Hello</div><div><br></div><div>Thank you for your quick reply.</div><div>Im not sure how to limit numbers reasonably above this.</div><div>Attached is the map i plotted. <br></div><div><br></div><div>And below my entire original script. would be grateful for any suggestions.</div><div><br></div><div> f= addfile("SLP_PHIS_Z3_PI.nc", "r") ;<br> T41 = f->Z3(:,{850},:,:)<br><br> printVarSummary(T41) ; [Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]<br><br> T41@_FillValue = -9.96921e+36 <br> ;print(T41)<br><br> aveX = dim_avg_n_Wrap(T41,0) <br> printVarSummary(aveX) ; (lat,lon)<br><br> aveX@_FillValue =9.96921e+36 <br> ;print(where(aveX.ne.0, aveX, aveX@_FillValue))<br><br> aveX = 1. / where(aveX.ne.0, aveX, aveX@_FillValue) <br> ; print(aveX)<br>;==============================================================<br><br> f1= addfile("totalwinds_PI.nc", "r") ;<br> T411 = f1->U(:,{850},:,:)<br><br> printVarSummary(T411) ; [Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]<br> T411@_FillValue = -9.96921e+36 <br><br> aveX1 = dim_avg_n_Wrap(T411,0) <br> printVarSummary(aveX1) ; (lat,lon)<br><br> aveX1@_FillValue = 9.96921e+36 <br><br> aveX1 = 1. / where(aveX1.ne.0, aveX1, aveX1@_FillValue) <br> ;print(aveX1)<br><br>;==============================================================<br> f2= addfile("th_PI.nc", "r") ;<br> T412 = f2->TH(:,{900},:,:)<br><br> printVarSummary(T412) ; [Time|12]x[ilev | 27] x [lat | 96] x [lon | 144]<br> T412@_FillValue = -9.96921e+36 <br><br> aveX2 = dim_avg_n_Wrap(T412,0) <br> printVarSummary(aveX2) ; (lat,lon)<br><br> aveX2@_FillValue = 9.96921e+36 <br><br> aveX2 = 1. / where(aveX2.ne.0, aveX2, aveX2@_FillValue) <br> ;print(aveX2)<br><br>;==============================================================<br>; Read latitudes <br>; The 'eady_growth_rate' function requires that 'lat' and 'th' agree<br>; Use 'conform' the propogate the lat values<br>;==============================================================<br><br> xlat = f->lat ; [lat | 96] <br> printVarSummary(xlat)<br><br> XLAT = conform ( aveX2 , xlat , 0 ) <br> printVarSummary(XLAT)<br> <br> copy_VarMeta(aveX2,XLAT)<br> printVarSummary(XLAT) <br><br> XLAT = 1. / where(XLAT.ne.0, XLAT, XLAT@_FillValue) <br> ;print(XLAT)<br><br>;==============================================================<br><br> egr = eady_growth_rate(aveX2, aveX1, aveX, XLAT, 0, 1)<br> printVarSummary(egr)<br><br> printMinMax(egr,0)<br><br> ;print(egr)<br> print("-----------------------------------------")<br><br>;==============================================================<br><br> wks = gsn_open_wks("pdf","Eady_850") ; send graphics to PNG file<br><br>;---Set some basic plot options<br><br> res = True<br> res@gsnMaximize = True ; maximize plot in frame<br> ;res@gsnAddCyclic = False<br><br> res@cnFillOn = True <br> res@cnLinesOn = False<br> ;res@cnFillMode = "RasterFill" ; slow here<br> res@cnFillMode = "CellFill" ; faster<br><br> res@tiMainString = "Baroclinicity at 850hPa"<br> res@gsnCenterString = " "<br> res@gsnLeftString = " "<br> res@gsnRightString = " "<br><br> ;res@cnFillPalette = "precip2_17lev" ;BrRiEgr<br><br><br> ;res@mpMaxLatF = 80 ; choose a different subregion<br> ;res@mpMinLatF = 30<br> ;res@mpMaxLonF = 70<br> ;res@mpMinLonF = -40<br> res@mpFillOn = False<br><br> res@lbBoxEndCapStyle = "TriangleBothEnds" <br> res@lbTitleString = "Maximum Eady growth rate per day" <br> res@lbTitlePosition = "bottom" ; title position<br> res@lbTitleFontHeightF = .012 ; make title smaller<br> ;res@pmLabelBarOrthogonalPosF =-0.01 ;-- move the labelbar upward<br> ;res@lbLabelFontHeightF = 0.01<br><br>;==============================================================<br>;Eady growth rate (1/day)<br><br> egr = egr*86400<br> egr@units = "annual 1/day"<br><br> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels<br> res@cnMinLevelValF = -2 ; set min contour level<br> res@cnMaxLevelValF = 2 ; set max contour level<br> res@cnLevelSpacingF = 0.2 ; set contour spacing<br><br><br> res@gsnRightString = egr@units<br> contour = gsn_csm_contour_map(wks, egr(:,:),res)<br><br>and this is the output: there is no error but upon printing i can see the gridpoints which are nan and some which have fillvalues assigned.</div><div>Variable: T41<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> lev : 867.1607600000013<br> mdims : 1<br> units : m<br> long_name : Geopotential Height (above sea level)<br> cell_methods : time: mean time: mean<br><br>Variable: aveX<br>Type: float<br>Total Size: 55296 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: 7<br> _FillValue : -9.96921e+36<br> lev : 867.1607600000013<br> mdims : 1<br> units : m<br> long_name : Geopotential Height (above sea level)<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: T411<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> lev : 867.1607600000013<br> mdims : 1<br> units : m/s<br> long_name : Zonal wind<br> cell_methods : time: mean time: mean<br><br>Variable: aveX1<br>Type: float<br>Total Size: 55296 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: 7<br> _FillValue : -9.96921e+36<br> lev : 867.1607600000013<br> mdims : 1<br> units : m/s<br> long_name : Zonal wind<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: T412<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br><br>Variable: aveX2<br>Type: float<br>Total Size: 55296 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: 7<br> _FillValue : -9.96921e+36<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: xlat<br>Type: double<br>Total Size: 768 bytes<br> 96 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [lat | 96]<br>Coordinates: <br> lat: [ -90.. 90]<br>Number Of Attributes: 2<br> long_name : latitude<br> units : degrees_north<br><br>Variable: XLAT<br>Type: double<br>Total Size: 110592 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [96] x [144]<br>Coordinates: <br><br>Variable: XLAT<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: 8<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br> _FillValue_original : 9.96921e+36<br> _FillValue : 9.969209968386869e+36<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>(0) -----------------------------------------<br><br><br><br></div><div><br></div><div><br></div><div>On Aug 22, 2018 2:33:35 PM, Barry Lynn wrote:
</div><blockquote class="felamimail-body-blockquote"><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" target="_blank">snandini@marum.de</a>> wrote:<br></div><blockquote class="felamimail-body-blockquote" 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="felamimail-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="felamimail-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="felamimail-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="felamimail-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 style="clear:both;"><div><br></div>-- <br><div dir="ltr" class="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>
</blockquote><br></body></html>