# [ncl-talk] Subscript Errors

Rick Brownrigg brownrig at ucar.edu
Mon Nov 2 11:11:58 MST 2015

```Hi Kelly,

I *think* there may be a misplaced parenthsis; you have:

MaxMonthT(0,i-1) = avg(MaxF(ind(datestrsplit(:,1)).eq.i))

but perhaps want:

MaxMonthT(0,i-1) = avg(MaxF(ind(datestrsplit(:,1).eq.i)))

as currently written, I think the sub-expression
ind(datestrsplit(:,1).eq.i) is returning an array of type logical, and
hence the error message

Hope that helps...
Rick

On Mon, Nov 2, 2015 at 10:39 AM, Kelly Neugent <kjneugent at mail.plymouth.edu>
wrote:

> Hello,
>
> I am attempting to run a do loop where I can get it to run monthly, but I
> keep getting an error message: "fatal:Illegal subscript. Vector subscripts
> must be integer"
>
> MaxMonthT = new((/3,12/),"double")
> x = new((/3,12/),"float")x = new((/3,12/),"float")
> do i=1,12,1
>
> MaxMonthT(0,i-1) = avg(MaxF(ind(datestrsplit(:,1)).eq.i))
> MaxMonthT(1,i-1) = max(MaxF(ind(datestrsplit(:,1)).eq.i))
> MaxMonthT(2,i-1) = min(MaxF(ind(datestrsplit(:,1)).eq.i))
>
> x(0,(i-1)) = i
> x(1,(i-1)) = i
> x(2,(i-1)) = i
>
> end do
>
>
>      I have checked both MaxF and datestrplit by using VarSummary and I
> have adjusted both of these so that they are integers.
> The error occurs on the 4th line shown here---MaxMonthT(0,i-1) =
> avg(MaxF(ind(datestrsplit(:,1)).eq.i))
>
> Could you provide any assistance on this matter? Thank you.
>
> _______________________________________________
> 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/20151102/9876ee6d/attachment.html
```

More information about the ncl-talk mailing list