Skip to content

Commit

Permalink
modify for timeslices and times (#7)
Browse files Browse the repository at this point in the history
* use import and export time strings
* add timeslice
  • Loading branch information
DeniseWorthen authored Jul 17, 2024
1 parent c2f71ad commit 326803d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cpl/module_cap_cpl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &
character(len=*),parameter :: subname='(module_cap_cpl:diagnose_cplFields)'
type(ESMF_Time) :: currTime
type(ESMF_State) :: state
character(len=240) :: timestr
type(ESMF_TimeInterval) :: timeStep
character(len=240) :: import_timestr, export_timestr
character(len=160) :: nuopcMsg
character(len=160) :: filename
!
call ESMF_ClockGet(clock_fv3, currTime=currTime, rc=rc)
call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timestep, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_TimeGet(currTime, timestring=timestr, rc=rc)
call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

call ESMF_ClockPrint(clock_fv3, options="currTime", preString="current time: ", unit=nuopcMsg)
Expand All @@ -52,7 +55,7 @@ subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &

! Dump Fields out
if (statewrite_flag) then
write(filename,'(A)') 'fv3_cap_import_'//trim(timestr)//'.tile*.nc'
write(filename,'(A)') 'fv3_cap_import_'//trim(import_timestr)//'.tile*.nc'
call State_RWFields_tiles(state,trim(filename), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
end if
Expand All @@ -68,7 +71,7 @@ subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &

! Dump Fields out
if (statewrite_flag) then
write(filename,'(A)') 'fv3_cap_export_'//trim(timestr)//'.tile*.nc'
write(filename,'(A)') 'fv3_cap_export_'//trim(export_timestr)//'.tile*.nc'
call State_RWFields_tiles(state,trim(filename), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
end if
Expand Down Expand Up @@ -236,7 +239,8 @@ subroutine State_RWFields_tiles(state,filename,rc)

enddo

call ESMF_FieldBundleWrite(fieldbundle, fileName=trim(filename), convention=convention, purpose=purpose, rc=rc)
call ESMF_FieldBundleWrite(fieldbundle, fileName=trim(filename), convention=convention, purpose=purpose, &
timeslice=1, overwrite=.true., rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

! -- Finalize
Expand Down

0 comments on commit 326803d

Please sign in to comment.