Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/1_namelist_ref
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/1_namelist_ref	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/1_namelist_ref	(revision 4811)
@@ -29,4 +29,5 @@
    nn_itend    =    5475   !  last  time step (std 5475)
    nn_date0    =  010101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_time0    =       0   !  initial time of day in hours
    nn_leapy    =       0   !  Leap year calendar (1) or not (0)
    ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
@@ -1067,11 +1068,11 @@
                            !     ln_ssh                  Logical switch for SSH observations
 
-   ln_sst     = .true.     ! Logical switch for SST observations
-   ln_reysst  = .true.     !     ln_reysst               Logical switch for Reynolds observations
+   ln_sst     = .false.     ! Logical switch for SST observations
+   ln_reysst  = .false.     !     ln_reysst               Logical switch for Reynolds observations
    ln_ghrsst  = .false.    !     ln_ghrsst               Logical switch for GHRSST observations      
 
    ln_sstfb   = .false.    ! Logical switch for feedback SST data
                            !     ln_sss                  Logical switch for SSS observations
-                           !     ln_seaice               Logical switch for Sea Ice observations
+   ln_seaice  = .false.    ! Logical switch for Sea Ice observations
                            !     ln_vel3d                Logical switch for velocity observations
                            !     ln_velavcur             Logical switch for velocity daily av. cur.
@@ -1094,6 +1095,7 @@
                            !     sstfiles                GHRSST input observation file name
    !                       ! sstfbfiles: Feedback SST input observation file name
-   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
+   sstfbfiles = 'sst_01.nc'
                            !     seaicefiles             Sea Ice input observation file name
+   seaicefiles = 'seaice_01.nc'
                            !     velavcurfiles           Vel. cur. daily av. input file name
                            !     velhvcurfiles           Vel. cur. high freq. input file name
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 4811)
@@ -29,4 +29,5 @@
    nn_itend    =    5475   !  last  time step (std 5475)
    nn_date0    =  010101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
+   nn_time0    =       0   !  initial time of day in hours
    nn_leapy    =       0   !  Leap year calendar (1) or not (0)
    ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
@@ -1085,11 +1086,11 @@
                            !     ln_ssh                  Logical switch for SSH observations
 
-   ln_sst     = .true.     ! Logical switch for SST observations
-   ln_reysst  = .true.     !     ln_reysst               Logical switch for Reynolds observations
+   ln_sst     = .false.     ! Logical switch for SST observations
+   ln_reysst  = .false.     !     ln_reysst               Logical switch for Reynolds observations
    ln_ghrsst  = .false.    !     ln_ghrsst               Logical switch for GHRSST observations      
 
    ln_sstfb   = .false.    ! Logical switch for feedback SST data
                            !     ln_sss                  Logical switch for SSS observations
-                           !     ln_seaice               Logical switch for Sea Ice observations
+   ln_seaice  = .false.    ! Logical switch for Sea Ice observations
                            !     ln_vel3d                Logical switch for velocity observations
                            !     ln_velavcur             Logical switch for velocity daily av. cur.
@@ -1112,6 +1113,7 @@
                            !     sstfiles                GHRSST input observation file name
    !                       ! sstfbfiles: Feedback SST input observation file name
-   sstfbfiles = 'sst_01.nc' 'sst_02.nc' 'sst_03.nc' 'sst_04.nc' 'sst_05.nc'
-                           !     seaicefiles             Sea Ice input observation file name
+   sstfbfiles = 'sst_01.nc'
+                           !     seaicefiles             Sea Ice input observation file names
+   seaicefiles = 'seaice_01.nc'  
                            !     velavcurfiles           Vel. cur. daily av. input file name
                            !     velhvcurfiles           Vel. cur. high freq. input file name
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OFF_SRC/domain.F90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OFF_SRC/domain.F90	(revision 4811)
@@ -117,6 +117,7 @@
       INTEGER  ::   ios                 ! Local integer output status for namelist read
       NAMELIST/namrun/ nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   &
-         &             nn_it000, nn_itend  , nn_date0    , nn_leapy     , nn_istate , nn_stock ,   &
-         &             nn_write, ln_dimgnnn, ln_mskland  , ln_clobber   , nn_chunksz, nn_euler
+         &             nn_it000, nn_itend  , nn_date0    , nn_time0     , nn_leapy  , nn_istate ,  &
+         &             nn_stock, nn_write, ln_dimgnnn  , ln_mskland   , ln_clobber, nn_chunksz,  &
+         &             nn_euler
       NAMELIST/namdom/ nn_bathy , rn_bathy, rn_e3zps_min, rn_e3zps_rat, nn_msh    , rn_hmin,   &
          &             nn_acc   , rn_atfp     , rn_rdt      , rn_rdtmin ,            &
@@ -153,4 +154,5 @@
          WRITE(numout,*) '      number of the last time step    nn_itend   = ', nn_itend
          WRITE(numout,*) '      initial calendar date aammjj    nn_date0   = ', nn_date0
+         WRITE(numout,*) '      initial time of day in hours    nn_time0   = ', nn_time0
          WRITE(numout,*) '      leap year calendar (0/1)        nn_leapy   = ', nn_leapy
          WRITE(numout,*) '      initial state output            nn_istate  = ', nn_istate
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 4811)
@@ -11,4 +11,5 @@
    !!             -   ! 2010-05  (D. Lea)  add calc_month_len routine based on day_init 
    !!            3.4  ! 2012-10  (A. Weaver and K. Mogensen) Fix for direct initialization
+   !!                 ! 2014-09  (D. Lea)  local calc_date removed use routine from OBS
    !!----------------------------------------------------------------------
 
@@ -17,5 +18,4 @@
    !!----------------------------------------------------------------------
    !!   asm_inc_init   : Initialize the increment arrays and IAU weights
-   !!   calc_date      : Compute the calendar date YYYYMMDDHH on a given step
    !!   tra_asm_inc    : Apply the tracer (T and S) increments
    !!   dyn_asm_inc    : Apply the dynamic (u and v) increments
@@ -40,4 +40,5 @@
 #endif
    USE sbc_oce          ! Surface boundary condition variables.
+   USE diaobs, ONLY: calc_date     ! Compute the calendar date on a given step
 
    IMPLICIT NONE
@@ -45,5 +46,4 @@
    
    PUBLIC   asm_inc_init   !: Initialize the increment arrays and IAU weights
-   PUBLIC   calc_date      !: Compute the calendar date YYYYMMDDHH on a given step
    PUBLIC   tra_asm_inc    !: Apply the tracer (T and S) increments
    PUBLIC   dyn_asm_inc    !: Apply the dynamic (u and v) increments
@@ -115,10 +115,11 @@
       INTEGER :: iiauper         ! Number of time steps in the IAU period
       INTEGER :: icycper         ! Number of time steps in the cycle
-      INTEGER :: iitend_date     ! Date YYYYMMDDHH of final time step
-      INTEGER :: iitbkg_date     ! Date YYYYMMDDHH of background time step for Jb term
-      INTEGER :: iitdin_date     ! Date YYYYMMDDHH of background time step for DI
-      INTEGER :: iitiaustr_date  ! Date YYYYMMDDHH of IAU interval start time step
-      INTEGER :: iitiaufin_date  ! Date YYYYMMDDHH of IAU interval final time step
       INTEGER :: ios             ! Local integer output status for namelist read
+
+      REAL(KIND=dp) :: ditend_date     ! Date YYYYMMDD.HHMMSS of final time step
+      REAL(KIND=dp) :: ditbkg_date     ! Date YYYYMMDD.HHMMSS of background time step for Jb term
+      REAL(KIND=dp) :: ditdin_date     ! Date YYYYMMDD.HHMMSS of background time step for DI
+      REAL(KIND=dp) :: ditiaustr_date  ! Date YYYYMMDD.HHMMSS of IAU interval start time step
+      REAL(KIND=dp) :: ditiaufin_date  ! Date YYYYMMDD.HHMMSS of IAU interval final time step
 
       REAL(wp) :: znorm        ! Normalization factor for IAU weights
@@ -187,17 +188,17 @@
 
       ! Date of final time step
-      CALL calc_date( nit000, nitend, ndate0, iitend_date )
+      CALL calc_date( nitend, ditend_date )
 
       ! Background time for Jb referenced to ndate0
-      CALL calc_date( nit000, nitbkg_r, ndate0, iitbkg_date )
+      CALL calc_date( nitbkg_r, ditbkg_date )
 
       ! Background time for DI referenced to ndate0
-      CALL calc_date( nit000, nitdin_r, ndate0, iitdin_date )
+      CALL calc_date( nitdin_r, ditdin_date )
 
       ! IAU start time referenced to ndate0
-      CALL calc_date( nit000, nitiaustr_r, ndate0, iitiaustr_date )
+      CALL calc_date( nitiaustr_r, ditiaustr_date )
 
       ! IAU end time referenced to ndate0
-      CALL calc_date( nit000, nitiaufin_r, ndate0, iitiaufin_date )
+      CALL calc_date( nitiaufin_r, ditiaufin_date )
 
       IF(lwp) THEN
@@ -215,9 +216,10 @@
          WRITE(numout,*) '       ndastp         = ', ndastp
          WRITE(numout,*) '       ndate0         = ', ndate0
-         WRITE(numout,*) '       iitend_date    = ', iitend_date
-         WRITE(numout,*) '       iitbkg_date    = ', iitbkg_date
-         WRITE(numout,*) '       iitdin_date    = ', iitdin_date
-         WRITE(numout,*) '       iitiaustr_date = ', iitiaustr_date
-         WRITE(numout,*) '       iitiaufin_date = ', iitiaufin_date
+         WRITE(numout,*) '       nn_time0       = ', nn_time0
+         WRITE(numout,*) '       ditend_date    = ', ditend_date
+         WRITE(numout,*) '       ditbkg_date    = ', ditbkg_date
+         WRITE(numout,*) '       ditdin_date    = ', ditdin_date
+         WRITE(numout,*) '       ditiaustr_date = ', ditiaustr_date
+         WRITE(numout,*) '       ditiaufin_date = ', ditiaufin_date
       ENDIF
 
@@ -236,8 +238,4 @@
          &                ' but ln_asmdin and ln_asmiau are both set to .false. :', &
          &                ' Inconsistent options')
-
-      IF ( ( ln_bkgwri ).AND.( ( ln_asmdin ).OR.( ln_asmiau ) ) )  &
-         & CALL ctl_stop( ' ln_bkgwri and either ln_asmdin or ln_asmiau are set to .true.:', &
-         &                ' The background state must be written before applying the increments')
 
       IF ( ( niaufn /= 0 ).AND.( niaufn /= 1 ) ) &
@@ -381,15 +379,15 @@
             WRITE(numout,*) 
             WRITE(numout,*) 'asm_inc_init : Assimilation increments valid ', &
-               &            ' between dates ', NINT( z_inc_dateb ),' and ',  &
-               &            NINT( z_inc_datef )
+               &            ' between dates ', z_inc_dateb,' and ',  &
+               &            z_inc_datef
             WRITE(numout,*) '~~~~~~~~~~~~'
          ENDIF
 
-         IF (     ( NINT( z_inc_dateb ) < ndastp      ) &
-            & .OR.( NINT( z_inc_datef ) > iitend_date ) ) &
+         IF (     ( z_inc_dateb < ndastp + nn_time0*0.01_wp ) &
+            & .OR.( z_inc_datef > ditend_date ) ) &
             & CALL ctl_warn( ' Validity time of assimilation increments is ', &
             &                ' outside the assimilation interval' )
 
-         IF ( ( ln_asmdin ).AND.( NINT( zdate_inc ) /= iitdin_date ) ) &
+         IF ( ( ln_asmdin ).AND.( zdate_inc /= ditdin_date ) ) &
             & CALL ctl_warn( ' Validity time of assimilation increments does ', &
             &                ' not agree with Direct Initialization time' )
@@ -518,9 +516,9 @@
             WRITE(numout,*) 
             WRITE(numout,*) 'asm_inc_init : Assimilation background state valid at : ', &
-               &  NINT( zdate_bkg )
+               &  zdate_bkg
             WRITE(numout,*) '~~~~~~~~~~~~'
          ENDIF
 
-         IF ( NINT( zdate_bkg ) /= iitdin_date ) &
+         IF ( zdate_bkg /= ditdin_date ) &
             & CALL ctl_warn( ' Validity time of assimilation background state does', &
             &                ' not agree with Direct Initialization time' )
@@ -550,112 +548,4 @@
       !
    END SUBROUTINE asm_inc_init
-
-
-   SUBROUTINE calc_date( kit000, kt, kdate0, kdate )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE calc_date  ***
-      !!          
-      !! ** Purpose : Compute the calendar date YYYYMMDDHH at a given time step.
-      !!
-      !! ** Method  : Compute the calendar date YYYYMMDDHH at a given time step.
-      !!
-      !! ** Action  : 
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(IN) :: kit000  ! Initial time step
-      INTEGER, INTENT(IN) :: kt      ! Current time step referenced to kit000
-      INTEGER, INTENT(IN) :: kdate0  ! Initial date
-      INTEGER, INTENT(OUT) :: kdate  ! Current date reference to kdate0
-      !
-      INTEGER :: iyea0    ! Initial year
-      INTEGER :: imon0    ! Initial month
-      INTEGER :: iday0    ! Initial day
-      INTEGER :: ihou0    ! Initial hour
-      INTEGER :: iyea     ! Current year
-      INTEGER :: imon     ! Current month
-      INTEGER :: iday     ! Current day
-      INTEGER :: ihou     ! Current hour
-      INTEGER :: idaystp  ! Number of days between initial and current date
-      INTEGER :: ihoustp  ! Number of hours
-      INTEGER :: idaycnt  ! Day counter
-
-      INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year
-
-      !-----------------------------------------------------------------------
-      ! Compute the calendar date YYYYMMDDHH
-      !-----------------------------------------------------------------------
-
-      ! Initial date
-      iyea0 =   kdate0 / 10000
-      imon0 = ( kdate0 - ( iyea0 * 10000 ) ) / 100
-      iday0 =   kdate0 - ( iyea0 * 10000 ) - ( imon0 * 100 )
-      ihou0 = nn_time0 
-
-      ! Check that kt >= kit000 - 1
-      IF ( kt < kit000 - 1 ) CALL ctl_stop( ' kt must be >= kit000 - 1')
-
-      ! Compute the number of days from the initial date
-      idaystp = INT( REAL( kt - kit000 ) * rdt / 86400. )
-      ihoustp = INT( REAL( kt - kit000 ) * rdt / 3600. ) - ( idaystp * 24 )
-
-      iday    = iday0
-      imon    = imon0
-      iyea    = iyea0
-      ihou    = ihou0
-      idaycnt = 0
-
-      ! Increment hours
-      ihou = ihou + ihoustp
-      IF ( ihou >= 24 ) THEN
-         ihou = ihou - 24
-         iday = iday + 1
-      ENDIF
-
-      CALL calc_month_len( iyea, imonth_len )
-
-      DO WHILE ( idaycnt < idaystp )
-         iday = iday + 1
-         IF ( iday > imonth_len(imon) )  THEN
-            iday = iday - imonth_len(imon)
-            imon = imon + 1
-         ENDIF
-         IF ( imon > 12 ) THEN
-            imon = 1
-            iyea = iyea + 1
-            CALL calc_month_len( iyea, imonth_len )  ! update month lengths
-         ENDIF                 
-         idaycnt = idaycnt + 1
-      END DO
-      !
-      kdate = iyea * 1000000 + imon * 10000 + iday * 100 + ihou
-      !
-   END SUBROUTINE
-
-
-   SUBROUTINE calc_month_len( iyear, imonth_len )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE calc_month_len  ***
-      !!          
-      !! ** Purpose : Compute the number of days in a months given a year.
-      !!
-      !! ** Method  : 
-      !!----------------------------------------------------------------------
-      INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year
-      INTEGER :: iyear         !: year
-      !!----------------------------------------------------------------------
-      !
-      ! length of the month of the current year (from nleapy, read in namelist)
-      IF ( nleapy < 2 ) THEN 
-         imonth_len(:) = (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
-         IF ( nleapy == 1 ) THEN   ! we are using calendar with leap years
-            IF ( MOD(iyear, 4) == 0 .AND. ( MOD(iyear, 400) == 0 .OR. MOD(iyear, 100) /= 0 ) ) THEN
-               imonth_len(2) = 29
-            ENDIF
-         ENDIF
-      ELSE
-         imonth_len(:) = nleapy   ! all months with nleapy days per year
-      ENDIF
-      !
-   END SUBROUTINE
-
 
    SUBROUTINE tra_asm_inc( kt )
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 4811)
@@ -83,7 +83,4 @@
 
       IF( .NOT. lk_offline ) CALL day_rst( nit000, 'READ' )
-
-      ! If we are starting at 00Z then need to wind back to previous day for calendar initialisation 
-      IF( nn_time0 .eq. 0 ) ndastp = ndastp - 1 
 
       ! set the calandar from ndastp (read in restart file and namelist)
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 4811)
@@ -138,5 +138,5 @@
          &             nn_it000, nn_itend, nn_date0    , nn_time0     , nn_leapy  , nn_istate ,  &
          &             nn_stock, nn_write, ln_dimgnnn  , ln_mskland   , ln_clobber, nn_chunksz,  &
-         &             nn_euler             
+         &             nn_euler
       NAMELIST/namdom/ nn_bathy, rn_bathy , rn_e3zps_min, rn_e3zps_rat, nn_msh, rn_hmin,   &
          &             nn_acc   , rn_atfp     , rn_rdt      , rn_rdtmin ,                  &
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 4811)
@@ -12,4 +12,5 @@
    !!   dia_obs      : Compute model equivalent to observations
    !!   dia_obs_wri  : Write observational diagnostics
+   !!   calc_date    : Compute the date of timestep in YYYYMMDD.HHMMSS format
    !!   ini_date     : Compute the initial date YYYYMMDD.HHMMSS
    !!   fin_date     : Compute the final date YYYYMMDD.HHMMSS
@@ -50,5 +51,6 @@
       &   dia_obs,      &  ! Compute model equivalent to observations
       &   dia_obs_wri,  &  ! Write model equivalent to observations
-      &   dia_obs_dealloc  ! Deallocate dia_obs data
+      &   dia_obs_dealloc, &  ! Deallocate dia_obs data
+      &   calc_date           ! Compute the date of a timestep
 
    !! * Shared Module variables
@@ -208,6 +210,30 @@
       !-----------------------------------------------------------------------
 
+      !Initalise all values in namelist arrays
+      enactfiles(:) = ''
+      coriofiles(:) = ''
+      profbfiles(:) = ''
+      slafilesact(:) = ''
+      slafilespas(:) = ''
+      slafbfiles(:) = ''
+      sstfiles(:)   = ''
+      sstfbfiles(:) = ''
+      seaicefiles(:) = ''
       velcurfiles(:) = ''
       veladcpfiles(:) = ''
+      velavcurfiles(:) = ''
+      velhrcurfiles(:) = ''
+      velavadcpfiles(:) = ''
+      velhradcpfiles(:) = ''
+      velfbfiles(:) = ''
+      velcurfiles(:) = ''
+      veladcpfiles(:) = ''
+      endailyavtypes(:) = -1
+      endailyavtypes(1) = 820
+      ln_profb_ena(:) = .FALSE.
+      ln_profb_enatim(:) = .TRUE.
+      ln_velfb_av(:) = .FALSE.
+      ln_ignmis = .FALSE.      
+
       CALL ini_date( dobsini )
       CALL fin_date( dobsend )
Index: branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/jul2greg.h90
===================================================================
--- branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/jul2greg.h90	(revision 4772)
+++ branches/2014/dev_r4650_UKMO7_STARTHOUR/NEMOGCM/NEMO/OPA_SRC/OBS/jul2greg.h90	(revision 4811)
@@ -16,4 +16,5 @@
       !!      ! 06-05  (A. Vidard) Reformatted and refdate      
       !!      ! 06-10  (A. Weaver) Cleanup
+      !!      ! 2014-09 (D. Lea) Change to use FLOOR to deal with negative prelday
       !!-----------------------------------------------------------------------
 
@@ -82,5 +83,5 @@
 
       zday = prelday
-      ksec = NINT( 86400. * MOD( zday, 1. ) )
+      ksec = FLOOR( 86400. * MOD( zday, 1. ) )
 
       IF ( ksec < 0. ) ksec = 86400. + ksec
