<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The error message is exactly telling you what the problem is.<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">fatal:Loop end must be scalar</div></div></div></div></blockquote><br class=""></div><div class="">You have </div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">do i = 0,time-1</div></div></div></div></blockquote><br class=""></div><div class="">i is a scalar integer, time is an array. You need to use dimsizes(time)-1.</div><div class=""><br class=""></div><div class="">Also you better not use loops to perform simple operations as they are slower tha assignments. </div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Il giorno 24 mar 2018, alle ore 07:10, Arijeet Dutta <<a href="mailto:arijeet.uoh@gmail.com" class="">arijeet.uoh@gmail.com</a>> ha scritto:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">Hi all, I am trying to calculate potential temperature as follows<br class=""><br class="">h = addfile("<a href="http://air.mon.mean.nc/" class="">air.mon.mean.nc</a>","r")<br class="">lat = h->lat<br class="">lon = h->lon<br class="">time = h->time<br class="">temp = h->air<br class="">l = h->level*10<br class=""><br class=""><br class="">a = temp(:,:,0,0) ;tim,lv,lat,lon,<br class="">do i = 0,time-1<br class=""> do j = 0,l-1<br class=""> theta(i,j) = a*(10000/l(j))^0.286<br class=""> end do<br class="">end do<br class=""><br class="">fatal:Loop end must be scalar, can't execute loop<br class=""><br class=""></div>Any help?<br class=""><br class=""></div>Regards<br class=""></div>Arijeet<br class=""></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>