[ncl-talk] Binning Data.

Arne Melsom arne.melsom at met.no
Tue Sep 23 08:34:01 MDT 2014


Hi Jonathan,
There might be a simpler way, but here's a snippet to get you started:

 x = (/2,3,4,5,6,7,2,1,3/)
 y = (/1,1,1,1,3,3,2,2,2/)
 binvaluey =(/1,2,3/)
 do n=0,dimsizes(binvaluey)-1
   indx = ind(y .eq. binvaluey(n))
   print(x(indx))      
   delete(indx)                    
 end do  

Good luck!
Arne


----- Original Message -----
> Hello NCL-Talk,
> 
> I am attempting to find a function that will allow me to bin data in one
> array while using another array as the boundaries.
> 
> For ex.
> x = (/2,3,4,5,6,7,2,1,3/)
> y = (1,1,1,1,3,3,2,2,2/)
> 
> binvaluey = 1, 4 values: (/2,3,4,5/)
> binvaluey = 2, 3 values: (/2,1,3/)
> binvaluey = 3, 2 values: (/6,7/)
> 
> I tried to find a function that would do this, but I am not seeing anything
> in the function list.  The only thing I can think of is create an array for
> each bin range, and using masks to isolate the values in the other array.
> 
> -Jonathan
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> 


More information about the ncl-talk mailing list