<div dir="ltr"><div><div><div><div>Hi All,<br><br></div>I wrote a code to calculate the weekly long term mean for snow covered area.<br></div>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></div>Here is the code<br><br>;*******************************************<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>;*******************************************<br>;Reading in the data<br><br>a=addfile(&quot;~/Documents/Snow_cover_IMS/<a href="http://nhsce_v01r01_19661004_20140602.nc">nhsce_v01r01_19661004_20140602.nc</a>&quot;,&quot;r&quot;)<br><br>sce=a-&gt;snow_cover_extent<br>time_sce=a-&gt;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/),&quot;float&quot;)<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></div>Thank You<br>Best Regards<br>Ipshita<br><div><br><br><br> <br><br><br><br><br></div></div>