[ncl-talk] loop error
Guido Cioni
guidocioni at gmail.com
Sat Mar 24 03:35:51 MDT 2018
The error message is exactly telling you what the problem is.
> fatal:Loop end must be scalar
You have
> do i = 0,time-1
i is a scalar integer, time is an array. You need to use dimsizes(time)-1.
Also you better not use loops to perform simple operations as they are slower tha assignments.
> Il giorno 24 mar 2018, alle ore 07:10, Arijeet Dutta <arijeet.uoh at gmail.com> ha scritto:
>
> Hi all, I am trying to calculate potential temperature as follows
>
> h = addfile("air.mon.mean.nc <http://air.mon.mean.nc/>","r")
> lat = h->lat
> lon = h->lon
> time = h->time
> temp = h->air
> l = h->level*10
>
>
> a = temp(:,:,0,0) ;tim,lv,lat,lon,
> do i = 0,time-1
> do j = 0,l-1
> theta(i,j) = a*(10000/l(j))^0.286
> end do
> end do
>
> fatal:Loop end must be scalar, can't execute loop
>
> Any help?
>
> Regards
> Arijeet
> _______________________________________________
> 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/20180324/244227ca/attachment.html>
More information about the ncl-talk
mailing list