[ncl-talk] Sub: Removing the missing values..

Alan Brammer abrammer at albany.edu
Tue Jun 23 13:07:19 MDT 2015


​
If you want to remove certain values from having an impact on the averaging
function, rather than messing about with the attributes you'd be better
using where() also I believe dim_avg_n_Wrap() is better than reordering the
dimensions where possible.
e.g.

u = clmMonTLL(u1)
u = where(u.eq.1, u at _FillValue, u)
anew= dim_avg_n_Wrap(u,0)



Some comments on your code.

​

> f    = addfile("precip.V1.0.mon.mean.nc", "r")   ; note the "s" of addfile
>
> u1 = f->precip
> ​=
>

> u = clmMonTLL(u1)
>
> u at _FillValue=1
>
 Define attribute _FillValue equal to 1. Side effect any values of 1 in the
array will now be tagged as _FillValue.​


> u at _missing_value=1
> u at missing_value=1
>
u at missing_value_original=1
>
​These are all meaningless in NCL and attributes named like this are
carried over for other languages/programs. ​

delete(u at _FillValue)

> delete(u at _missing_value)
> delete(u at missing_value)
> delete(u at missing_value_original)
>
​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.


> ​...​

anew= dim_avg_Wrap(u(lat|:,lon|:,month|:))
>
​This function would have ignored data in u ​that was equal to u at _FillValue,
but you deleted that attribute so NCL doesn't know to ignore it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150623/ceab4396/attachment.html 


More information about the ncl-talk mailing list