[ncl-talk] Subscript out of range error

Dennis Shea shea at ucar.edu
Tue Sep 9 06:40:37 MDT 2014


This is basic debugging. It is not the size of the arrays, rather the
subscripts
that are referencing some location out of range.

The error message:
fatal:Subscript out of range, error in subscript #1
fatal:["Execute.c":7743]:
Execute: Error occurred at or near line 28 in file


 26   do i=0,nlevels-2
 27     ii = ind(apr.ge.levels(i).and.apr.lt.levels(i+1))
 28     data2d(i,ii) = apr(ii)
 29     labels(i) = levels(i) + ":" + levels(i+1)
 30     delete(ii)
 31   end do

Well ...... Put prints *before* line 28 printing the values of i and ii.

     ii = ind(apr.ge.levels(i).and.apr.lt.levels(i+1))
     print("i="+i+"   ii="+ii)    ; basic debug approach
     data2d(i,ii) = apr(ii)

ii could even be missing ...


On Tue, Sep 9, 2014 at 5:01 AM, Ipsita Putatunda <ipsita.putatunda at gmail.com
> wrote:

> In continuation of my previous mail, I have a little query.
> http://www.ncl.ucar.edu/Applications/Scripts/scatter_5.ncl in the same
> script I simply tried to see how does it works with npts=56 instead of 300
> and the same script is giving the similar error (Subscript out of range,
> error in subscript #1) as am getting in my script. It is working only with
> some larger number like 200 and above. Why is it happening? can anyone give
> me some idea?
>
> Thanks,
> Ipsita
>
> On Tue, Sep 9, 2014 at 3:31 PM, Ipsita Putatunda <
> ipsita.putatunda at gmail.com> wrote:
>
>> Hi all,
>>    Am doing something similar to
>> http://www.ncl.ucar.edu/Applications/Scripts/scatter_5.ncl
>> this scatter plot. While doing this am getting error:
>>
>> fatal:Subscript out of range, error in subscript #1
>> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 28 in
>> file
>>
>> I have checked the dimension and size of my array at line 28.
>> Which gives :
>>
>> Variable: data2d
>> Type: float
>> Total Size: 1568 bytes
>>             392 values
>> Number of Dimensions: 2
>> Dimensions and sizes:    [7] x [56]
>> Coordinates:
>> Number Of Attributes: 1
>>   _FillValue :    9.96921e+36
>>
>> Variable: apr
>> Type: float
>> Total Size: 224 bytes
>>             56 values
>> Number of Dimensions: 1
>> Dimensions and sizes:    [56]
>> Coordinates:
>> Number Of Attributes: 1
>>   _FillValue :    9.96921e+36
>>
>> But still am getting the same error. Any help will be appreciated.
>> My script is attached herewith.
>>
>> Thanks in advance,
>> Ipsita
>>
>>
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20140909/7bd42696/attachment.html 


More information about the ncl-talk mailing list