<div dir="ltr"><div>You can not directly check for _FillValue. Specifically:  k2.ne.k2@_FillValue will not do the correct test.<br></div><div>You must use a function. eg: in fortran:<code><b>   ieee_is_nan(</b>x)</code></div><div><br></div><div>In NCL: <b><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml">ismissing</a> </b>... please read the documentation<br><b></b></div><div><br></div><div><br></div><div>Try replacing: <br></div><div><span style="font-variant-ligatures:no-common-ligatures">      ifa = where(k2.ne.k2@_FillValue,diag(:,k2),diag@_FillValue)</span></div><div><span style="font-variant-ligatures:no-common-ligatures">with</span></div><div><span style="font-variant-ligatures:no-common-ligatures">      ifa = where(<b><span style="color:rgb(0,0,255)">.not.</span>ismissing</b>(k2), diag(:,k2), diag@_FillValue)</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 24, 2019 at 10:37 AM Laura Fowler via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hello:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I have the following arrays:</div><div class="gmail_default" style="font-size:small"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:13px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Courier;font-size:13px">Variable: diag</span><br></div><div class="gmail_default" style="font-size:small">
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Type: float</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 1297613240 bytes</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span>            </span>324403310 values</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 2</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">   </span>[nCells | 5898242] x [nVertLevels | 55]</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Coordinates:<span> </span></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 3</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>_FillValue :<span style="white-space:pre-wrap">        </span>9.96921e+36</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>long_name :<span style="white-space:pre-wrap"> </span>Ice-friendly aerosol number concentration</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>units :<span style="white-space:pre-wrap">     </span>nb kg^{-1}</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Variable: k2</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Type: integer</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 23592968 bytes</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><span>            </span>5898242 values</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 1</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[nCells | 5898242]</span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Coordinates:<span> </span></span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 1</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">













</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>_FillValue :<span style="white-space:pre-wrap">        </span>0</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">where nCells is the horizontal dimension and nVertLevels is the number of vertical levels. you can think of k2 as the index for the base of a convective cloud with a missing value set to zero. I would like to build an array nifa which contains the value of diag at k2, such that:</span><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">nifa(iCell) = diag(:,k2(iCell)) for iCell varying between 0 and nCells-1.</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">I tried to use the function "where" but this did not work. I get the following:</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)">





</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">nifa = where(k2.ne.k2@_FillValue,diag(:,k2),diag@_FillValue)</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font:13px Courier;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:NclMalloc Failed:[errno=12]</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)">






</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Segmentation fault (core dumped)</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">I am not sure why this is not working. I also tried the ismissing function but this did not work either. Any suggestions?</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Thanks,</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Laura</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-------------------------------------------------------------------------------------------------------------</font><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Laura D. Fowler                                                                                       </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Mesoscale and Microscale Meteorology Division (MMM)         </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">National Center for Atmospheric Research<br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">P.O. Box 3000, Boulder CO 80307-3000</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">phone: 303-497-1628</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-------------------------------------------------------------------------------------------------------------</font><br></div></div></div></div>
_______________________________________________<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></blockquote></div>