[ncl-talk] Error:fatal:Subscript out of range/error in subscript # 0

Ipshita Majhi ipmajhi at alaska.edu
Tue Jul 29 16:49:09 MDT 2014

Here are the details of my code:-
1) I am writing a code to calculate decadal monthly mean from the matrix
called air(all india rainfall) and it is a 133 X 12 matrix

The errors are as follows:-

fatal:Subscript out of range/error in subscript #0
fatal:["Excute.c":8128]:Execute :Error occurred at or near line 39 in file


Here is the program:-

;Calculating decadal mean

;This is to read in the all india rainfall and to plot them

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

ncol = 12

air=readAsciiTable("~/Documents/PhD_June_2015/Data_AIR/air.txt", ncol,

;ya = dim_avg_n(air,1)   ;yearly average

;This is for yearly decadal mean

yearly_decadal = new( dimsizes(ya)/10, float)  ;;; assumes ya%10 is 0.  if
not end indices will be ignored.

ct = 0
do i=0, dimsizes(ya)-10, 10  ;  loop from 0 to max length of array and step
by 10
yearly_decadal(ct) = avg( ya(i:i+9) )
ct = ct+1
end do

;This is for monthly decadal mean
;This is a two dimensional matrix

mda=new((/13,12/),"float"); mda=monthly decadal average

do i=0, 133-10,10

do j=0,11


end do
end do

Can you help me with this

Thanking you in advance
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140729/da89ec6d/attachment.html 

More information about the ncl-talk mailing list