c
c  %W%
c
      subroutine readbg

      include'mladv.inc'

      parameter (nptsmax=100)

      dimension zbg(nptsmax),tbg(nptsmax),stbg(nptsmax)

      real interpp

      common/parm/kz,m,mm1,mm2,mp1,msq,tim,tmax,tstart,hy,rea,dt,
     +   xbasin,yy(mx0),icalc,kzp1,kzm1,iftop,ifbot,iftvv,ifrel,theta,
     +   ifsbl,ifeva

      open(unit=imlrbg,file=bgfile,form='formatted',status='old')

      i = 1
 1    read(imlrbg,*,end=2)d1,zbg(i),tbg(i),d2,stbg(i)
      i = i + 1
      goto 1

 2    continue
      npts = i - 1

      do 3 k=1,l

         tnew  = interpp(-zml(k),zbg,tbg,npts,1.e35,1.e35)
         stnew = interpp(-zml(k),zbg,stbg,npts,1.e35,1.e35)
         bnew = bofst(stnew)

         do 4 ip=1,msq
            temp(ip,k,mlcur) = tnew - tqgofk(ip,k)
            buoy(ip,k,mlcur) = bnew - bqgofk(ip,k)
 4        continue

 3     continue

      return
      end
