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

From: Alan Brammer <abrammer_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 20 2013 - 19:19:08 MDT

Your previous email had the solution to this. To use a subscript of a variable it needs to be predefined. Therefore you need to add the following before the do loop.

dum1 = new( k, graphic) ; assuming you are going to have k number of objects.
do i=0,k-1
…..
dum1(i) = …..
end do

Alan.

##############################
Alan Brammer,
PhD Student,

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer@albany.edu
##############################

On Aug 20, 2013, at 7: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 Tue Aug 20 19:20:23 2013

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