[ncl-talk] error:dimensions on left do not match the dimension on right

Mary Haley haley at ucar.edu
Thu Nov 13 08:42:06 MST 2014


I think the issue may simply be with the "week_52(46-i)" part.

When ever you get an error message about index values out-of-range, it's
always a good idea to recheck your math and make sure that the array
indexes are what you expect.

If you print out "46-i" inside the do loop you get values 46,45.,...39,38

week_52 is of length 38, and you are trying to subscript it using values >=
38.

--Mary




On Wed, Nov 12, 2014 at 3:25 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Hi,
>
> I am getting above mentioned for the text colored in red
> Thank you
>
> *******************************************************************
>
> ;Now extracting indices for year with 52 weeks
>
> year_52=ispan(1967,2013,1)
> year_53=(/1968,1973,1979,1984,1990,1996,2001,2007,2012/)
> ;print(dimsizes(year_53))
>
> t=dimsizes(year_52)-dimsizes(year_53)
>
> ;print(t)
>
>
>
> ;Find the indices where the two matrices have same value
>
> week_same=new(9,"integer")
> week_52=new(38,"integer")
>
> do i=0,9-1
>
> week_53=year_53(i)
> week_same(i)=ind(year_52.eq.week_53)
> week_52(46-i)=year_52(ind(year_52.ne.week_same)) ; This is to get the
> years which are not equal to years with 53 weeks
> end d
>
> _______________________________________________
> 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/20141113/67bae4cd/attachment.html 


More information about the ncl-talk mailing list