In read_phypar.F, lines 3692-3698 read
Code: Select all
#ifdef AVERAGES
IF ((nAVG(ng).gt.0).and.(ndefAVG(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefAVG(ng)
CALL edit_file_struct (ng, OutFiles, AVG)
AVG(ng)%load=0 ! because delayed creation of NetCDF file
END IF ! due to time-aveeraging
#endif
Later, in output.F, line 320 is
Code: Select all
AVG(ng)%files(Fcount)=TRIM(AVG(ng)%name)
I can eliminate the problem by ensuring that the number of AVG files is at least 1, adding the following small check after OutFiles has been defined:
Code: Select all
IF (nAVG(ng).lt.ndefAVG(ng)) OutFiles=Outfiles+1
Code: Select all
! If multiple output files, edit derived type structure to store the
! information about all multi-files.
!
DO ng=1,Ngrids
IF ((nHIS(ng).gt.0).and.(ndefHIS(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefHIS(ng)
IF (nHIS(ng).le.ndefHIS(ng)) OutFiles=Outfiles+1 ! because IC
CALL edit_file_struct (ng, OutFiles, HIS)
END IF
IF ((nQCK(ng).gt.0).and.(ndefQCK(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefQCK(ng)
IF (nQCK(ng).le.ndefQCK(ng)) OutFiles=Outfiles+1 ! because IC
CALL edit_file_struct (ng, OutFiles, QCK)
END IF
#ifdef ADJOINT
IF ((nADJ(ng).gt.0).and.(ndefADJ(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefADJ(ng)
IF (nADJ(ng).le.ndefADJ(ng)) OutFiles=Outfiles+1 ! because IC
CALL edit_file_struct (ng, OutFiles, ADM)
END IF
#endif
#ifdef AVERAGES
IF ((nAVG(ng).gt.0).and.(ndefAVG(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefAVG(ng)
IF (nAVG(ng).lt.ndefAVG(ng)) OutFiles=Outfiles+1
CALL edit_file_struct (ng, OutFiles, AVG)
AVG(ng)%load=0 ! because delayed creation of NetCDF file
END IF ! due to time-aveeraging
#endif
#ifdef DIAGNOSTICS
IF ((nDIA(ng).gt.0).and.(ndefDIA(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefDIA(ng)
IF (nDIA(ng).lt.ndefDIA(ng)) OutFiles=Outfiles+1
CALL edit_file_struct (ng, OutFiles, DIA)
DIA(ng)%load=0 ! because delayed creation of NetCDF file
END IF ! due to time-aveeraging
#endif
#if defined TANGENT || defined TL_IOMS
IF ((nTLM(ng).gt.0).and.(ndefTLM(ng).gt.0)) THEN
OutFiles=ntimes(ng)/ndefTLM(ng)
IF (nTLM(ng).le.ndefTLM(ng)) OutFiles=Outfiles+1 ! because IC
CALL edit_file_struct (ng, OutFiles, TLM)
END IF
#endif
END DO