Re: How to run a loop to plot a map from a one-dimension array?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 21 2013 - 11:27:39 MDT

Jenny,

The error message is telling you what the problem is:

> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading x_avg

I don't know what "k" is equal to, but at some point it must be greater than 5, which is how many elements you have in x_avg.
This will cause the "subscript out of range" error.

Double check your value for "k".

--Mary

On Aug 20, 2013, at 5:13 PM, Jenny Hung <jhung@geol.sc.edu> wrote:

> Hi all,
> I am trying to run a loop for plotting a map from a one-dimension array, x_avg = (1.1,1.2,1.3,1.4,1.5).
> Please help me with the following code.
> do i = 0, k-1
> loopnum=loopnum+1
> gsres@gsFillColor = GetFillColorIndex(cnLevels,polycol,x_avg(i));
> gsres@gsEdgeColor = GetFillColorIndex(cnLevels,polycol,x_avg(i));
> dum1(i) = gsn_add_polygon(wks,map,(/minlons(i),minlons(i),maxlons(i),maxlons(i)/), /minlats(i),maxlats(i),maxlats(i),minlats(i)/),gsres)
> whites(loopnum)=tilename(loopnum)
> end do
>
> I got the error as follows.
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading x_avg
> fatal:Execute: Error occurred at or near line....
>
> Thanks!
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Aug 21 11:27:50 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 21 2013 - 13:54:15 MDT