INTERFACE:
subroutine htapes_wrapup ()DESCRIPTION:
Write and/or dispose history tape(s)
Determine if next time step is beginning of history interval and if so:
increment the current time sample counter, open a new history file
if needed (i.e., when ntim = 1), write history data to current history
file, reset field accumulation counters to zero
If primary history file is full or at the last time step of the simulation,
write restart dataset and close and dispose all history fiels
If history file is full or at the last time step of the simulation:
close history file and dispose to mass store (only if file is open)
reset time sample counter to zero if file is full
Daily-averaged data for the first day in September are written on
date = 00/09/02 with mscur = 0
Daily-averaged data for the first day in month mm are written on
date = yyyy/mm/02 with mscur = 0
Daily-averaged data for the 30th day (last day in September) are written on
date = 0000/10/01 mscur = 0
Daily-averaged data for the last day in month mm are written on
date = yyyy/mm+1/01 with mscur = 0
!USES
use clm_varctl, only : archive_dir, mss_wpass, mss_irt
use fileutils, only : set_filename, putfil
use spmdMod, only : masterproc
use time_manager, only : get_nstep, get_curr_date, get_curr_time, get_prev_date
use shr_const_mod, only: SHR_CONST_CDAY
use shr_sys_mod, only : shr_sys_flush
ARGUMENTS:
implicit none !REVISION HISTORY Created by Mariana Vertenstein