﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
605	Corrected FLOATS restart	arango	arango	"Corrected a problem in '''def_floats.F''' when setting the '''DRIFTER(ng)%bounded''' switch during restart.  If the floats have not been released yet at restart time, the values of '''Xgrid''', '''Ygrid''', and '''Zgrid''' will be '''_FillValue''' (i.e. '''1.0E+37''') in the FLOATS NetCDF file.  The calls to '''netcdf_get_fvar''' in '''def_floats.F''' will replace such values with zeros.

Therefore, we need to read '''Zgrid''' first so the '''DRIFTER(ng)%bounded''' switch is '''FALSE''' in such cases to trigger the release.  This switch will be set corrected if '''Xgrid''' and '''Ygrid''' are read last.  The zero values in '''Xgrid''' and/or '''Ygrid''' due to unreleased floats will set '''DRIFTER(ng)%bounded=FALSE''' because of the lower bound is 0.5 in fractional coordinates. So the order of operations in '''def_floats.F''' is very important during restart.

The correct code is then:

{{{
# ifdef SOLVE3D
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Zgrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(N(ng),r8)).or.                           &
     &        (Tinp(l).lt.0.0_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(izgrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(izrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO
!
# endif
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Xgrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(Lm(ng)+1,r8)-0.5_r8).or.                 &
     &        (Tinp(l).lt.0.5_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(ixgrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(ixrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO
!
        CALL netcdf_get_fvar (ng, iNLM, ncname, 'Ygrid',                &
     &                        Tinp,                                     &
     &                        ncid = FLT(ng)%ncid,                      &
     &                        start = (/1,FLT(ng)%Rindex/),             &
     &                        total = (/Nfloats(ng),1/))
        IF (exit_flag.ne.NoError) RETURN

        DO l=1,Nfloats(ng)
          IF ((Tinp(l).gt.REAL(Mm(ng)+1,r8)-0.5_r8).or.                 &
     &        (Tinp(l).lt.0.5_r8)) THEN
            DRIFTER(ng)%bounded(l)=.FALSE.
          ELSE
            DRIFTER(ng)%bounded(l)=.TRUE.
            DO i=0,NFT
              DRIFTER(ng)%track(iygrd,i,l)=Tinp(l)
              DRIFTER(ng)%track(iyrhs,i,l)=0.0_r8
            END DO
          END IF
        END DO

}}}

Many thanks to Diego Narvaez for bringing this issue to my attention. This issue was also discussed in [https://www.myroms.org/forum/viewtopic.php?f=14&t=2378 forum] sometime ago but I was not able to reproduce it."	bug	new	major	Release ROMS/TOMS 3.7	Nonlinear	3.7			
