[ncl-talk] Question regarding array averaging

Prashanth Bhalachandran prashanth.bhalachandran at gmail.com
Mon Oct 16 18:05:48 MDT 2017


Hello all, 
I am trying to take an average of nine 1D arrays that I have .. a1 to a9 all of them of the dimension 	[lev | 11]

If my understanding is right, the average functions in NCL doesn’t simply allow you to do avg(a1….a9). Please correct me if I am wrong. 

The other way around is that I combine the 9 arrays in to a 11x9 array using a function that Dennis have posted out in the past. Is this the way around it? Or is there a simpler/less computationally intensive way of doing it?
function combine (x[*], y[*]) 
begin 
    nx = dimsizes(x) 
    ny = dimsizes(y) 
    if (nx.eq.my) then 
         xy = new ( (/nx,2/), typeof(x)) ; (row,col) 
         xy(:,0) = (/ x /) 
         xy(:,1) = (/ y /) 
         return (xy) 
    end if 

    print("combine error") 
    exit 
end 


Thank you, 
Prashanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171016/50aff580/attachment.html>


More information about the ncl-talk mailing list