c
c     file: /export/software/puddle0/dems/printchan.f
c     Last Modified: 11/06/96
c
c     Written by: Glenn E. Moglen
c
c     Program prints TO SCREEN the i, j coordinates of all 
c     pixels exceeding a user-specified threshold area.
c
      Program main            
      PARAMETER(IGRIDY=1400,IGRIDX=1400)          
      integer*4 nx, ny, area(igridy, igridx)
      real*4 dx, dy
      CHARACTER*80 DEMFILE,POINTFILE,AREAFILE,NEWFILE            
C                                          
C     READ INPUT
C
      OPEN(UNIT=11,FILE='branch.in',STATUS='OLD')
      READ(11,22) DEMFILE,POINTFILE,AREAFILE,NEWFILE
      close (11, status = 'keep')
 22   FORMAT(A80/A80/A80/A80)              
      CALL demread (area, areafile, NX, NY, IGRIDY, DX, DY)
      if(nx.gt.igridx.or.ny.gt.igridy)then
         write(6,38) nx, igridx, ny, igridy
 38      format(1x,'array dimensions too small'/
     +           1x,'x',2i8,'    y',2i8)
         stop
      endif
      print *, 'Enter channel threshold area'
      read *, ithresh
      do i = 1, nx
         do j = 1, ny
            if (area(j, i) .gt. ithresh) then
               print *, j, i
            end if
         end do
      end do
      end
      
 
