c SETUPEMP.FOR
c
c used by PREP5.BAT
c
      character ifile*80, id*56, pgm*8
      print*,'input grid:'
      read(5,100) ifile
100   format(a)
      open(10,file=ifile,status='old',form='unformatted')
      read(10) id,pgm,nc,nr,nz,xo,dx,yo,dy
      close(10)
      print*,'final nc nr:'
      read(5,*) nc1,nr1
      nc1=(nc1+nc)/2
      nr1=(nr1+nr)/2
      xo1=xo-dx*((nc1-nc)/2)
      yo1=yo-dy*((nr1-nr)/2)
      open(11,file='setupemp.res',status='unknown',form='formatted')
      write(11,100) 'empty.grd'
      write(11,*) nc1,nr1
      write(11,*)
      write(11,*) xo1,yo1,dx,dy
      close(11)
      open(12,file='prep5.rec',status='unknown',form='formatted')
      write(12,100) '1'
      write(12,*) xo,yo
      write(12,100) '2'
      write(12,*) nc,nr
      close(12)
      stop
      end
