c     file: /export/software/puddle0/dems/readdemraw.f
c     Last Modified: 11/06/96
c
c     Written by: Glenn E. Moglen
c
c     Reads raw USGS file, strips off header, and outputs DEM matrix
c     compatible with other DEM programs.
c
      program main
      parameter (igridy = 1250)
      integer*2 elev(igridy, igridy)
      real*4 dx, dy
      integer*4 nx, ny
      character*80 outfile, infile, trash
      open (10, file = 'readdemraw.in', form = 'formatted', 
     +          status = 'old')
      read (10, 100) infile, outfile
      close (10, status = 'keep')
      nx = 1201
      ny = 1201
      dx = 90
      dy = 90      
      open (15, file = infile, form = 'formatted', 
     +          status = 'old')
      read (15, 100) trash
      do i = 1, ny
         read (15, *) t1, t2, t3, t4, t5, t6, t7, t8, t9,
     +                (elev(i, j), j = 1, nx)
      end do
      close (15, status = 'keep')
      call demwrite (elev, outfile, nx, ny, igridy, dx, dy)
 100  format (a80)
      end
      
