[ncl-talk] Help
Guido Cioni
guidocioni at gmail.com
Tue Aug 1 08:47:20 MDT 2017
No, there is officially no function, but you can define a new one that does the job pretty well.
Here is the prototype that goes before the program "begin".
function avg_zeros(x:numeric)
; compute average not considering zeros,
; --> in: rain rate
; <-- out: average rain rate
local N
begin
N=num(x .ne. 0)
return(sum(x)/ N)
end
Example of a function call
rain=avg_zeros(ts->precp_r)
Cheers
> On 1. Aug 2017, at 08:32, Arun Kumar Dwivedi <dwivedi.arunkumar at gmail.com> wrote:
>
> Hello All,
>
> In NCL ,how to calculate average of any array or data while ignoring all the zeros
> If there is any command or function, kindly let me know.
>
> Thanks & Regards
> Arun Kumar Dwivedi,
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170801/c0c79f6e/attachment.html
More information about the ncl-talk
mailing list