[ncl-talk] Is this a loop that can be sped up?

Rashed Mahmood rashidcomsis at gmail.com
Sun Sep 22 06:11:41 MDT 2019


Hi Barry,
How about using where function: supposing that, z_plane, threshold, and
prob_b_24  all have same dimension sizes, then:
*prob_b_24 = where( z_plane.ge.threshold, prob_b_24+1, prob_b_24)*

*NOTE, this is untested so please make sure it works the way you would
expect it to be.*

Cheers,
Rashed




On Sun, Sep 22, 2019 at 2:26 AM Barry Lynn via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hello:
>
> I've been doing this for a long time, and am wondering if there is a way
> to speed up this kind of array checking for exceedance values.
>
> Thank you.
>
>    do j = 0,dims2d(0)-1
>
>    do i = 0,dims2d(1)-1
>
>     if (z_plane(j,i).ge.threshold(j,i))then
>
>      prob_b_24(j,i) = prob_b_24(j,i)+1
>
>     end if
>
>    end do
>
>    end do
>
> --
> Barry H. Lynn, Ph.D
> Senior Associate Scientist, Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190922/877c29b6/attachment.html>


More information about the ncl-talk mailing list