<div dir="ltr"><div>That was not quite right. My apologies. Please see documentation for the <b>where</b> function. It is actually legal for the conditional mask to contain missing values. But when the mask contains missing values, then missing values are returned in the output array, in the corresponding positions. This is the behavior that you saw originally.</div><div><br></div><div>The remedy is the same as before, use <b>where (ismissing ())</b> as shown below.</div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 27, 2020 at 5:11 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">This is not valid:<br><br> <b>VAR = where (VAR.eq.VAR@_FillValue, 0., VAR)</b><br><br>... because the array result of the <b>".eq."</b> operator, with fill values present, can contain three values: True, False, and fill value. The <b>"where"</b> function must receive a conditional mask (first argument) that contains only <b>True</b> and <b>False</b>.</div><div dir="ltr"><br></div><div dir="ltr">This construction will form the desired missing value mask, and do what you intended:<br><br> <b>VAR = where (ismissing (VAR), 0., VAR)</b><br><br>Next, if <b>VAR@missing_value</b> is different than the original <b>VAR@_FillValue</b>, then you should keep the second statement the way you had it, to change <b>"missing_values"</b> to zero.<div><span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium"><br></span></div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 27, 2020 at 4:50 PM Adam Herrington via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>I have a variable that I am trying to remove the missing values from. Here are the attributes from printVarSummary call:</div><div><br></div><div>Variable: VAR<br>Type: float<br>Total Size: 8220672 bytes<br> 2055168 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 223] x [lat | 32] x [lon | 288]<br>Coordinates: <br> time: [9504..10170]<br> lat: [-14.60732984293194..14.60732984293194]<br> lon: [ 0..358.75]<br>Number Of Attributes: 9<br> remap : remapped via ESMF_regrid_with_weights: Bilinear<br> _FillValue : -9999.9<br> missing_value : -9999.9<br> time_statistic : instantaneous<br> units : <br> long_name : precipitation<br> comments : Unknown1 variable comment<br> delta_t : 0000-00-00 03:00:00<br> avg_period : 0000-00-00 01:00:00<br></div><div><br></div><div>So there are two missing value attributes. To set all missing values to zero, I try:</div><div><br></div><div> VAR = where(VAR.eq.VAR@_FillValue,0.,VAR)<br> VAR = where(VAR.eq.VAR@missing_value,0.,VAR)<br></div><div><br></div><div>But then subsequently looking for missing values: nMsg = num(ismissing(VAR)), it says there are still all the missing values:</div><div><br></div><div>(0) missing values present: not allowed: nMsg=17913<br></div><div><br></div><div>Does anyone see why this is occurring, why my where statements are not resulting in num(ismissing(VAR))=0?</div><div><br></div><div>Thanks,</div><div><br></div><div>Adam</div></div></blockquote></div></div></div></div></div></div>
</blockquote></div></div>