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

From: Wen.J.Qu <wen.j.qu_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 26 2012 - 15:54:36 MDT

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
Received on Wed Sep 26 23:54:41 2012

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