Subroutine sststp(sstupstep)
  Implicit none
  INCLUDE "parmeta.f90"
  INCLUDE "parm.tbl.f90"
  INTEGER, PARAMETER    :: la=13
  INTEGER, PARAMETER    :: imjm=im*jm-jm/2,jam=6+2*(jm-10)  &
       , lp1=lm+1,ltop=1,lbot=lm , lscrch=4*lm+1+la +1  &
       , l1=la+lm+1,l2=la+2*lm+1 , l3=la+3*lm+1,l4=la+4*lm+1
  INCLUDE "ctlblk.f90"
  INCLUDE "loops.f90"
  INCLUDE "masks.f90"
  INCLUDE "phys.f90"

  integer,intent(in)           :: sstupstep
  integer                      :: day
  integer                      :: mon
  integer                      :: yr
  integer                      :: utc
  integer                      :: ma
  integer                      :: mb
  real*4                       :: yday
  real*4                       :: add
  real*4                       :: fa
  real*4                       :: fb
  integer, dimension(12)       :: monl
!*
  data monl /31,28,31,30,31,30,31,31,30,31,30,31/
  read(chardate,'(I4,3I2)')yr,mon,day,utc
  If (mod(yr,4) .eq. 0) monl(2)=29

!*
  call getdate(yr,mon,day,utc,sstupstep,0,chardate)
  yday=day
  ma=mon-1
  If ((yday.ge.(1.0+float(monl(mon))/2.0)).or.((ntsd.eq.1).and.(yday.gt.15))) ma=mon
  mb=ma+1
  If (ma .lt. 1) ma=12
  If (mb .gt. 12) mb=1
  add=float(monl(ma))/2.0-1.0
  If (ma.eq.mon) add=-add-2.0
  fb=2.0*(yday+add)/float(monl(ma)+monl(mb))
  fa=1.0-fb
  If ((ntsd.eq.1).and.(int(yday).eq.15)) Then
    sst=sstr(:,:,ma)
  Else
    sst=fa*sstr(:,:,ma)+fb*sstr(:,:,mb)
  Endif
  write(*,*)'Updating SST at time: ',chardate,'wghta=',fa,'wghtb=',fb
  !*** Write Update SST at each INT(ntsd/nsst)
  open(97,file='SSTUPDATE'//chardate//'.dat',status='unknown')
  write(97)sst
  close(97)
  write(*,*)'Updating SST at time: ',chardate
End Subroutine sststp
