<div dir="ltr">A minor bit of information. <br>From 6.1.1 onward the 'reassignment operator' ( := )could be used. This avoids the need for delete(indx).<br><br><a href="https://www.ncl.ucar.edu/prev_releases.shtml#NewOperator6.1.1">https://www.ncl.ucar.edu/prev_releases.shtml#NewOperator6.1.1</a><br>-----------------------------<br>do while (k .lt. dimsizes(z))<br>
m = m + 1<br>
v(m) = min(z)<br>
indx := ind(z .eq. v(m)) ; <--- reassignment operator :=<br>
z(indx) = z@_FillValue<br>
k = k + dimsizes(indx)<br>
end do<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 23, 2014 at 9:00 AM, Arne Melsom <span dir="ltr"><<a href="mailto:arne.melsom@met.no" target="_blank">arne.melsom@met.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">...I don't think ncl has a unique value function, so in case you want to get 'binvaluey' from 'y', try e.g.<br>
<br>
z = y<br>
z@_FillValue = -999<br>
v = z<br>
m = -1<br>
k = 0<br>
do while (k .lt. dimsizes(z))<br>
m = m + 1<br>
v(m) = min(z)<br>
indx = ind(z .eq. v(m))<br>
z(indx) = z@_FillValue<br>
k = k + dimsizes(indx)<br>
delete(indx)<br>
end do<br>
binvaluey = v(0:m)<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
----- Original Message -----<br>
> Hi Jonathan,<br>
> There might be a simpler way, but here's a snippet to get you started:<br>
><br>
> x = (/2,3,4,5,6,7,2,1,3/)<br>
> y = (/1,1,1,1,3,3,2,2,2/)<br>
> binvaluey =(/1,2,3/)<br>
> do n=0,dimsizes(binvaluey)-1<br>
> indx = ind(y .eq. binvaluey(n))<br>
> print(x(indx))<br>
> delete(indx)<br>
> end do<br>
><br>
> Good luck!<br>
> Arne<br>
><br>
><br>
> ----- Original Message -----<br>
> > Hello NCL-Talk,<br>
> ><br>
> > I am attempting to find a function that will allow me to bin data in one<br>
> > array while using another array as the boundaries.<br>
> ><br>
> > For ex.<br>
> > x = (/2,3,4,5,6,7,2,1,3/)<br>
> > y = (1,1,1,1,3,3,2,2,2/)<br>
> ><br>
> > binvaluey = 1, 4 values: (/2,3,4,5/)<br>
> > binvaluey = 2, 3 values: (/2,1,3/)<br>
> > binvaluey = 3, 2 values: (/6,7/)<br>
> ><br>
> > I tried to find a function that would do this, but I am not seeing anything<br>
> > in the function list. The only thing I can think of is create an array for<br>
> > each bin range, and using masks to isolate the values in the other array.<br>
> ><br>
> > -Jonathan<br>
> > _______________________________________________<br>
> > ncl-talk mailing list<br>
> > List instructions, subscriber options, unsubscribe:<br>
> > <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
> ><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>