PUBLIC INTERFACE ~ PUBLIC ROUTINES ~ ERROR MESSAGES

## Module diag_output_mod

Contact: Seth Underwood
Reviewers:
Change History: WebCVS Log

#### OVERVIEW

`diag_output_mod` is an integral part of `diag_manager_mod`. Its function is to write axis-meta-data, field-meta-data and field data

#### OTHER MODULES USED

          mpp_io_mod
     mpp_domains_mod
             mpp_mod
       diag_axis_mod
       diag_data_mod
    time_manager_mod
             fms_mod

#### PUBLIC INTERFACE

diag_output_init:
  Registers the time axis and opens the output file.
write_axis_meta_data:
  Write the axes meta data to file.
write_field_meta_data:
  Write the field meta data to file.
done_meta_data:
  Writes axis data to file.
diag_field_out:
  Writes field data to an output file.
diag_flush:
  Flush buffer and insure data is not lost.
get_axis_index:
  Return the axis index number.
get_diag_global_att:
  Return the global attribute type.
set_diag_global_att:
  Set the global attribute type.

#### PUBLIC ROUTINES

1. #### diag_output_init

       SUBROUTINE diag_output_init (file_name, format, file_title, file_unit, all_scalar_or_1d, domain)

   DESCRIPTION
     Registers the time axis, and opens the file for output.
   INPUT

     `file_name` | Output file name [CHARACTER(len=*)]
     `format` | File format (Currently only 'NETCDF' is valid) [INTEGER]
     `file_title` | Descriptive title for the file [CHARACTER(len=*)]
     `all_scalar_or_1d` | [LOGICAL]
     `domain` | [TYPE(domain2d)]

   OUTPUT

     `file_unit` | File unit number assigned to the output file. Needed for subsuquent calls to `diag_output_mod` [INTEGER]

2. #### write_axis_meta_data

       SUBROUTINE write_axis_meta_data (file_unit, axes, time_ops)

   DESCRIPTION
   INPUT

     `file_unit` | File unit number [INTEGER]
     `axes` | Array of axis ID's, including the time axis [INTEGER, DIMENSION(:)]
     `time_ops` | .TRUE. if this file contains any min, max, or time_average [LOGICAL, OPTIONAL]

3. #### write_field_meta_data

       TYPE(diag_fieldtype) FUNCTION write_field_meta_data (file_unit, name, axes, units, long_name, rnage, pack, mval, avg_name, time_method, standard_name, interp_method)

   DESCRIPTION
     The meta data for the field is written to the file indicated by file_unit
   INPUT

     `file_unit` | Output file unit number [INTEGER]
     `name` | Field name [CHARACTER(len=*)]
     `axes` | Array of axis IDs [INTEGER, DIMENSION(:)]
     `units` | Field units [CHARACTER(len=*)]
     `long_name` | Field's long name [CHARACTER(len=*)]
     `range` | Valid range (min, max). If min > max, the range will be ignored [REAL, DIMENSION(2), OPTIONAL]
     `pack` | Packing flag. Only valid when range specified. Valid values: 1 = 64bit 2 = 32bit 4 = 16bit 8 = 8bit [INTEGER, OPTIONAL] [Default: 2]
     `mval` | Missing value, must be within valid range [REAL, OPTIONAL]
     `avg_name` | Name of variable containing time averaging info [CHARACTER(len=*), OPTIONAL]
     `time_method` | Name of transformation applied to the time-varying data, i.e. "avg", "min", "max" [CHARACTER(len=*), OPTIONAL]
     `standard_name` | Standard name of field [CHARACTER(len=*), OPTIONAL]
     `interp_method` | [CHARACTER(len=*), OPTIONAL]

4. #### done_meta_data

       SUBROUTINE done_meta_data (file_unit)

   DESCRIPTION
     Writes axis data to file. This subroutine is to be called once per file after all `write_meta_data` calls, and before the first `diag_field_out` call.
   INPUT

     `file_unit` | Output file unit number [INTEGER]

5. #### diag_field_out

       SUBROUTINE diag_field_out (file_unit, field, data, time)

   DESCRIPTION
     Writes field data to an output file.
   INPUT

     `file_unit` | Output file unit number [INTEGER]
     `time` | [REAL, OPTIONAL]

   INPUT/OUTPUT

     `field` | [TYPE(diag_fieldtype)]
     `data` | [REAL, DIMENSIONS(:,:,:,:)]

6. #### diag_flush

       call diag_flush (file_unit)

   DESCRIPTION
     This subroutine can be called periodically to flush the buffer, and insure that data is not lost if the execution fails.
   INPUT

     `file_unit` | Output file unit number to flush [INTEGER]

7. #### get_axis_index

       INTEGER FUNCTION get_axis_index (num)

   DESCRIPTION
     Return the axis index number.
   INPUT

     `num` | [INTEGER]

8. #### get_diag_global_att

       call get_diag_global_att (gAtt)

   DESCRIPTION
     Return the global attribute type.
   OUTPUT

     `gAtt` | [TYPE(diag_global_att_type]

9. #### set_diag_global_att

       call set_diag_global_att (component, gridType, timeName)

   DESCRIPTION
     Set the global attribute type.
   INPUT

     `component` | [CHARACTER(len=*)]
     `gridType` | [CHARACTER(len=*)]
     `tileName` | [CHARACTER(len=*)]

#### ERROR MESSAGES

FATAL in diag_output_init
  invalid format
FATAL in write_axis_meta_data
  number of axes < 1
FATAL in write_axis_meta_data
  writing meta data out-of-order to different files.
FATAL in write_field_meta_data
  number of axes < 1
FATAL in write_field_meta_data
  writing meta data out-of-order to different files
FATAL in write_field_meta_data
  axis data not written for field

top