Hi Jamie,
I think the best way to do this is by using the function ind:
http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml
Example:
x is dimensioned (time,lat,lon)
x1d = ndtooned(x) ;convert array to 1D, necessary for ind use
temp = ind(x1d.ge.0.) ;grab the indice of all values > 0.
x1d(temp) = x1d(temp) - 360.
x = (/ onedtond(x1d,dimsizes(x)) /) ;put 1D array back in x
delete(temp)
delete(x1d)
Adam
James D Scott wrote:
> I have a relatively large array of floating point values. I want take all
> the positive values and subtract 360.0 from them. Is there an
> efficient way to do this without looping through the individual elements
> of the array?
>
> Thanks,
>
> Jamie Scott
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli@ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Tue May 17 2005 - 08:17:44 MDT