C***********************************************************************
C*****************************************************************
C getobs_4c.f 
C read *.uxe file (UneXplained Elevation) 
C based on getobs_8c.f 
C   return mesh name from input file. CGH  
C
C getobs_8b.f  18 May 1998 
C Charles Hannah
C get observations from file format *.m3d 
C  t,x,y,elev 
C  t   : time in gmt0  (decimal days)
C  x,y : position in meters and inside mesh being used
C  elev : observed elevaton, in m 
C
C
      Subroutine GETOBS_4c(lun,Nobs, Xobs, Yobs, Tobsgmt0, 
     & Elevobs,nobsdim,iyear,meshname)
C
c june 9 '97: from getobs_8.f
c
      integer lun
      integer Nobs
      real Xobs(nobsdim), Yobs(nobsdim)
      real Tobsgmt0(nobsdim)
      real Elevobs(nobsdim) 
      integer nobsdim
      integer iyear
      character*(*) meshname 

C local variables 
      integer i, ncol
      character*120 header 

C   read and discard header
      HEADER=' '
      do while(HEADER(1:4).NE.'XXXX')
         read(lun,'(A)')HEADER
      enddo
C   read comment line, year, and number of columns
      read(lun,'(A)')meshname
      read(lun,'(A)')HEADER
      read(lun,*)IYEAR
      read(lun,*)NCOL
        if(NCOL.lt.4) then 
           write(2,*)'GETOBS_4c: Not enough data columns; Stopping'
           write(2,*)'NCOL = ',NCOL
           close(2)
           stop
        endif
c        
      if(NCOL.gt.4) then 
         write(2,22) NCOL
   22 Format('GetObs_4c: There are',I3, ' data columns in file ',(A))
         write(2,'(a)')' Only the first 4 data columns will be used.'
      endif

C   read the forcing data

      i=1       
  100 continue
         read(lun,*,end=101)tobsgmt0(i),xobs(i),yobs(i),elevobs(i)
	 if(i.gt.nobsdim) then 
	    write(2,*)'GETOBS_4c: Too many observations; Stopping '
	    write(2,*)'NOBSDIM = ',nobsdim 
	    close(2)
	    stop
	 endif
         i=i+1
      go to 100
  101 continue
      nobs=i-1
      write(*,*)'GetObs_4c: meshname, ',meshname(1:4)
      write(*,*)'GetObs_4c: nobs, ncol ',nobs,ncol
C
      close(lun)
c

      write(*,*)'getobs_4c',tobsgmt0(1),tobsgmt0(nobs)
      return
      end
