
      SUBROUTINE WRITE_UVERROR
         
	 include 'CASCO.DIM'
         include 'observes.h'
	 include 'errors.h'
         include 'misc.h' 


	 integer iyear, ncol
	 real    YDAYUTC0

	 integer ii

         character*132 m3dfile
         character*30  mesh, obsfile

         mesh = meshname 
         obsfile = 'unknown' 

         if(nobs.gt.0) then 
            CALL GDAY_UTC0(KDOBS(1),SECOBS(1),IYEAR,YDAYUTC0)
            ncol = 8
         else
            IYEAR = 0
         endif

         write(*,*)'Name for final velocity error file'
         read(*,'(a)') m3dfile
         write(*,'(a)')m3dfile

         open(1,file=m3dfile,status='unknown')
         write(1,'(A)')'XXXX'
         write(1,'(A)')MESH
         write(1,'(A)')OBSFILE
         write(1,'(I4)')IYEAR
         write(1,'(I4)')ncol


         do ii = 1, nobs
            CALL GDAY_UTC0(KDOBS(ii),SECOBS(ii),IYEAR,YDAYUTC0)
            WRITE(1,'(F10.4,2F10.0,2E14.6,3F10.1)') YDAYUTC0, 
     &        xobs(ii),yobs(ii),uerr_best(ii),verr_best(ii),  
     &        zminobs(ii), zmaxobs(ii), zbottomobs(ii)  
         enddo
         close(1)

      RETURN
      END
