<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="gmail_default" style="font-family:verdana,sans-serif">​</div><div class="gmail_default" style="font-family:verdana,sans-serif">If you want to remove certain values from having an impact on the averaging function, rather than messing about with the attributes you&#39;d be better using where() also I believe dim_avg_n_Wrap() is better than reordering the dimensions where possible. </div><div class="gmail_default" style="font-family:verdana,sans-serif">e.g.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif">u = clmMonTLL(u1)</span><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">u = where(u.eq.1, u@_FillValue, u)</div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif">anew= dim_avg_n_Wrap(u,0</span><span style="font-family:arial,sans-serif">)</span><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Some comments on your code. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">​</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>f    = addfile(&quot;<a href="http://precip.V1.0.mon.mean.nc" target="_blank">precip.V1.0.mon.mean.nc</a>&quot;, &quot;r&quot;)   ; note the &quot;s&quot; of addfile<br><br>u1 = f-&gt;precip<div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">​=</div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><br>u = clmMonTLL(u1)<br><br>u@_FillValue=1<br></div></div></div></blockquote><div> <span style="font-family:verdana,sans-serif">Define attribute _FillValue equal to 1. Side effect any values of 1 in the array will now be tagged as _FillValue.​</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>u@_missing_value=1<br>u@missing_value=1 </div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>u@missing_value_original=1<br></div></div></div></blockquote><div class="gmail_default" style="font-family:verdana,sans-serif">​These are all meaningless in NCL and attributes named like this are carried over for other languages/programs. ​</div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif"><br></span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif">delete(u@_FillValue) </span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>delete(u@_missing_value)<br>delete(u@missing_value)<br>delete(u@missing_value_original)<br></div></div></div></blockquote><div><div class="gmail_default" style="font-family:verdana,sans-serif">​These lines have just removed NCLs knowledge of what should be a _FillValue​.  These lines only affect metadata and have had no impact on the data in u.  </div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">​...​</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>anew= dim_avg_Wrap(u(lat|:,lon|:,month|:))<br></div></div></div></blockquote><div><div class="gmail_default" style="font-family:verdana,sans-serif">​This function would have ignored data in u ​that was equal to u@_FillValue, but you deleted that attribute so NCL doesn&#39;t know to ignore it now. </div><br></div><div> </div></div></div></div>