<div dir="ltr"><div>Virtually <b>ALL interpreted languages </b>[NCL, Python, Matlab, GrADS, ...] are 'slow'. This is often noted for large multiple do loop cases.<br></div><div><br></div><div>The key in any of these languages is to use the utilities:</div><div><br></div><div>; check entire array</div><div><br></div><div>    if (<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/any.shtml"><b>any</b></a>(<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml"><b>ismissing</b></a>(RH))) then</div><div>        print("RH: _FillValue present skip processing")</div><div>    else</div><div>'       ...</div><div>    end if</div><div><br></div><div>---</div><div>Some prefer the .not. operator before the <b>any</b><br></div><div><br></div><div><div>    if (<b>.not.</b> <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/any.shtml"><b>any</b></a>(<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml"><b>ismissing</b></a>(RH))) then</div><div>       ...</div><div>    else<br></div><div>        print("RH: _FillValue present skip processing"</div><div>    end if</div><div><br></div></div><div><br></div><div>---</div><div>; check each temporal intex</div><div><br></div><div>    do nt=0,ntim-1</div><div><div>         if (<b>any</b>(<b>ismissing</b>(RH(<b>nt</b>,:,:,:)))) then  ; RH(time,level,lt,lon)<br></div><div>              print("RH: _FillValue present skip processing")</div><div>          else</div><div>'       ...</div><div>         end if</div><div>    ...</div><div>    end do<br></div><div><br></div></div><div><br></div><div>    <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 7, 2019 at 2:43 PM Anahita Amiri Farahani <<a href="mailto:aamir003@ucr.edu">aamir003@ucr.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi all,<br><div><br></div><div>I am trying to use if condition in ncl for my case but apparently ncl is really slow when the loops are large, do you have any suggestions to modify this code:</div><div><br></div><div><div>do i=0,419</div><div>do j=0,95</div><div>do k=0,143</div><div><br></div><div>if (ismissing(RH_1(i,j,k))) then</div></div><div><br></div><div>print("Your data is missing. Cannot create plot.")<br></div><div><br></div><div>else</div><div><br></div><div>print("You can plot.")<br></div><div><br></div><div>end if</div><div>end do</div><div>end do</div><div>end do</div><div><br></div><div>Thanks,</div><div>Ana</div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>