<div dir="ltr"><div>Thank you very much. Yes it was the same line with the sce_week(i,52) which was giving an error. I will specify line number too next t<br><br></div>Best Regards<br>Ipshita<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 6, 2014 at 12:46 PM, Michael Notaro <span dir="ltr"><<a href="mailto:mnotaro@wisc.edu" target="_blank">mnotaro@wisc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's a good idea to specify which line # is giving the error message.<br>
<br>
<br>
sce_week has dimensions of 47,52.<br>
<br>
Therefore, sce_week(i,52) is out of range.<br>
The 2nd dimension is 0:51, so 52 is too large.<br>
<br>
<br>
<br>
<br>
Michael<br>
<span class=""><br>
<br>
On 11/06/14, Ipshita Majhi wrote:<br>
> Hi All,<br>
><br>
><br>
> I wrote a code to calculate the weekly long term mean for snow covered area.<br>
><br>
> First I wanted to create a matrix which had each years week and then finally calculate it. while trying to create such a matrix I get the above mentioned error. If anyone can help it would be great.<br>
><br>
> Here is the code<br>
><br>
> ;*******************************************<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
> ;*******************************************<br>
> ;Reading in the data<br>
><br>
</span>> a=addfile("~/Documents/Snow_cover_IMS/<a href="http://nhsce_v01r01_19661004_20140602.nc" target="_blank">nhsce_v01r01_19661004_20140602.nc</a>(<a href="http://nhsce_v01r01_19661004_20140602.nc" target="_blank">http://nhsce_v01r01_19661004_20140602.nc</a>)","r")<br>
<div class="HOEnZb"><div class="h5">><br>
> sce=a->snow_cover_extent<br>
> time_sce=a->time<br>
><br>
><br>
> ;Now converting the time from georgian to ut_calender<br>
> ;Doing an area average for sce<br>
><br>
> sce_area=wgt_areaave_Wrap(sce,1.0,1.0, 0)<br>
><br>
> ut_sce=cd_calendar(time_sce,0)<br>
><br>
><br>
> ;Extracting just the year information from the time series<br>
><br>
> xyears=ut_sce(:,0)<br>
><br>
> ;This part of code is to create a matrix with each years weekly data<br>
> ;The years go from 1967 to 2013 i.e 47 years with 52 weeks for each year<br>
><br>
> sce_week=new((/47,52/),"float")<br>
><br>
><br>
> do i=1,47<br>
><br>
> years=ispan(1967,2013,1)<br>
><br>
> yind=years(i)<br>
><br>
> time_ind= ind(xyears.eq.yind) ; We are extracting each year one by one<br>
><br>
> z=dimsizes(time_ind)<br>
><br>
> sce_ind=sce_area(time_ind); extracting the array of sce which matches the indices<br>
><br>
> sce_year=sce_ind(1:52); This is to take only 52 weeks from the indices for each year<br>
><br>
> sce_reshape=reshape(sce_year,(/1,52/)); This is putting the output with one row and 52 columns<br>
><br>
> sce_week(i,52)=sce_reshape; This is putting the array in the new array<br>
><br>
> if (z.gt.52) then ; This is for years which have more then 52 weeks<br>
> i=i+1<br>
> end if<br>
><br>
> end do<br>
> ;*****************************************************************************<br>
><br>
><br>
> Thank You<br>
> Best Regards<br>
> Ipshita<br>
</div></div></blockquote></div><br></div>