﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
900	Multi-file option in time-averaging output files	arango		"There have been two [https://www.myroms.org/forum/viewtopic.php?p=23206 reports] about the **AVERAGES** multi-file option [https://www.myroms.org/forum/viewtopic.php?p=23213#p23213 failing] during restart.  I looked into the debugger again, and I could not reproduce the error.  I tried eight different combinations with **NTIMES**, **NAVG**, and **NDEFAVG**. Thus, I don't know what specific set of values makes that logic fail.

However, I examined the possibility of adding the same logic used in history files to the time-averaging files. It turns out that augmenting the **!OutFiles** is not that harmful when all the elements of the arrays in the derived type structure (**T_IO**) are not filled in some cases.
 {{{
#ifdef AVERAGES
        IF ((nAVG(ng).gt.0).and.(ndefAVG(ng).gt.0)) THEN
          OutFiles=ntimes(ng)/ndefAVG(ng)
          IF ((nAVG(ng).eq.ndefAVG(ng)).or.                             &
     &        (MOD(ntimes(ng),ndefAVG(ng)).ge.nAVG(ng))) THEN
            OutFiles=Outfiles+1
          END IF
          CALL edit_file_struct (ng, OutFiles, AVG)
          AVG(ng)%load=0       ! because delayed creation of NetCDF file
        END IF                 ! due to time-averaging
#endif
#ifdef DIAGNOSTICS
        IF ((nDIA(ng).gt.0).and.(ndefDIA(ng).gt.0)) THEN
          OutFiles=ntimes(ng)/ndefDIA(ng)
          IF ((nDIA(ng).eq.ndefDIA(ng)).or.                             &
     &        (MOD(ntimes(ng),ndefDIA(ng)).ge.nDIA(ng))) THEN
            OutFiles=Outfiles+1
          END IF
          CALL edit_file_struct (ng, OutFiles, DIA)
          DIA(ng)%load=0       ! because delayed creation of NetCDF file
        END IF                 ! due to time-averaging
#endif
}}}
"	defect	closed	major	Release ROMS/TOMS 4.0	Nonlinear	3.9	Fixed		
