Re: What is wrong with this "ind" loop for a 2D array?

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 26 2012 - 16:14:51 MDT

Please use standard debugging methods. Insert three lines in front of
the line that fails:

print (ii)
print (jj)
printVarSummary (fog)
FOG = fog(ii,jj) ; this is the line that fails

--Dave

On Wed, Sep 26, 2012 at 3:54 PM, Wen.J.Qu <wen.j.qu@gmail.com> wrote:
> Hi, dear NCL users,
>
> Would you please give me some hint of what is wrong with the "ind" loop for
> a 2D array as shown below?
>
> Thanks a lot.
>
> Shawn
>
>
> ################################################################
>
> When I run it, it shows:
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading fog
> fatal:Execute: Error occurred at or near line "FOG = fog(ii,jj)" in the file
>
> ################################################################
>
> ;--fog is a nrows*ncols 2D array.
> ;--Get indices where fog value is 1, that is fog happens.
> ii = new(nrows,integer)
> jj = new(ncols,integer)
> do i=0,nrows-1
> do j=0,ncols-1
> ii(i) = ind(fog(i,j).eq.1)
> jj(j) = ind(fog(i,j).eq.1)
> end do
> end do
>
> FOG = fog(ii,jj)
> ;Debug print
> print(FOG)
> #################################################################
>
>
> ________________________________
> Wen.J.Qu
> 2012-09-26
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 27 00:14:59 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 02 2012 - 13:38:41 MDT