Subroutine WRITE_OHIST

source: (poseidon.ohist.f90) [ c_92_rp1 release ]

POSEIDON_HISTORY_MODULE

Description:

Write accumulated ocean history data to a file.

The steps are

1. Check that the history accumulator ACCUMULATE_OHIST has been called. If not, call it with weight = 1.0

2. Average the Ohist variables (divide state and forcing quantities by the accumulator, call AverageDiagnostic to average the diagnostics

3. Write the ZDF file data

4. Reset the Ohist%D diagnostic

Note that no resetting of the history data is done. If the supervisor will call this routine more than once, it is expected that it will do:

call WRITE_OHIST( ohist, ih, ic, write_control) write_control = .false. call ResetDiagnostic( ocean%diag ) call INITIALIZE_OHIST(ohist)

GrADS Control File

The routine will try and create an appropriate GrADS (http://grads.iges.org) control file to unit iu if write_control is set to true. 7 additional optional arguments are provided which aid in this creation:

n_secs,n_mins, etc. tell the routine how often you plan to call WRITE_OHIST. This is used in the TDEF line to create the time interval.

The file_template is used in the DSET line. If templating is to be used, then it should agree in a reasonable way with the length of the run, and the interval between calls. Samples:

             file_template="^o_%m2_%y4.zdf"    

GrADS control files may need some tweaking before you can reasonably use GrADS. Particularly difficult is getting TDEF right, and you may need to add BIG_ENDIAN to the OPTIONS line. (We have already inserted OPITONS SEQUENTIAL). The main asset of this routine is that it does the XDEF and YDEF properly and sets up the VARS list.

A netCDF interface is being planned, but that will probably be in a separate routine, such as WRITE_OHIST_NCDF

Syntax:

TYPE (T_POSEIDON_HISTORY) :: ohist Ocean history object
INTEGER :: iu Fortran unit number for History file output
INTEGER :: ic Fortran unit number for GrADS control file output
LOGICAL :: write_control if true, write a control file. This is typically done only the first time
INTEGER :: n_secs Number of seconds, minutes, hours,
INTEGER :: n_mins days, months, or years between
INTEGER :: n_hours calls to WRITE_OHIST. This information
INTEGER :: n_days is only used when writing the GrADS
INTEGER :: n_months control file to get the TDEF increment right
INTEGER :: n_years
CHARACTER(LEN=*,*) :: file_template String for GrADS control file DSET option ( Include ^ if desired )

call WRITE_OHIST(ohist,iu,ic,write_control,[n_secs],[n_mins],[n_hours],[n_days],[n_months],&

[n_years], [file_template])

INTENT(IN) :: iu,ic,n_secs,n_mins,n_hours,n_days,n_months,n_years,file_template


Legend:INTENT(INOUT)INTENT(IN)INTENT(OUT)[OPTIONAL]

Subroutines Called:

assert, WRITE_PARALLEL, ACCUMULATE_OHIST, time_average_data, compute_number_of_variables, create_control_file, MAKE_ZDF_HEADER, PUT_PARAMETERS, SENDOUT3, SENDOUT2, HCURL, ResetDiagnostic
Subroutines Parameters Variables

Poseidon Ocean Model (Release: c_92_rp1 )
Documentation automation by Paul Schopf's DocFort Perl scripts.