Skip to content

Commit

Permalink
Merge pull request #483 from FESOM/refactoring_meanio_filesplit_freq
Browse files Browse the repository at this point in the history
Option to split output files by month
  • Loading branch information
JanStreffing authored Mar 13, 2024
2 parents 6693352 + 28702d3 commit 856b1e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gen_modules_clock.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module g_clock
integer :: ndpyr !number of days in yearnew
integer :: num_day_in_month(0:1,12)
character(4) :: cyearold, cyearnew !year as character string
character(2) :: cmonth !month as character string
data num_day_in_month(0,:) /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
data num_day_in_month(1,:) /31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/

Expand Down Expand Up @@ -55,6 +56,7 @@ subroutine clock
aux2=aux1+num_day_in_month(fleapyear,i)
if(daynew>aux1 .and. daynew<=aux2) then
month=i
write(cmonth, '(I2.2)') month
day_in_month=daynew-aux1
exit
end if
Expand Down
11 changes: 8 additions & 3 deletions src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ module io_MEANDATA
logical, save :: vec_autorotate=.FALSE.
logical, save :: lnextGEMS=.FALSE.
integer, save :: nlev_upper=1
character(len=1), save :: filesplit_freq='y'
type io_entry
CHARACTER(len=15) :: id ='unknown '
INTEGER :: freq =0
Expand Down Expand Up @@ -141,7 +142,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
type(t_tracer), intent(in) , target :: tracers
type(t_dyn) , intent(in) , target :: dynamics
type(t_ice) , intent(in) , target :: ice
namelist /nml_general / io_listsize, vec_autorotate, lnextGEMS, nlev_upper
namelist /nml_general / io_listsize, vec_autorotate, lnextGEMS, nlev_upper, filesplit_freq
namelist /nml_list / io_list

#include "associate_part_def.h"
Expand Down Expand Up @@ -1287,8 +1288,12 @@ subroutine output(istep, ice, dynamics, tracers, partit, mesh)
entry%thread_running = .false.

! define filepath
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'.nc'

if (filesplit_freq=='m') then
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'_'//cmonth//'.nc'
else
filepath = trim(ResultPath)//trim(entry%name)//'.'//trim(runid)//'.'//cyearnew//'.nc'
endif

!___________________________________________________________________
! only root rank task does output
if(partit%mype == entry%root_rank) then
Expand Down

0 comments on commit 856b1e5

Please sign in to comment.