FMS  2024.03
Flexible Modeling System
diag_data_mod

Type descriptions and global variables for the diag_manager modules. More...

Data Types

type  coord_type
 Define the region for field output. More...
 
type  diag_atttype
 Attribute type for diagnostic fields. More...
 
type  diag_axis_type
 Type to hold the diagnostic axis description. More...
 
type  diag_fieldtype
 Diagnostic field type. More...
 
type  diag_global_att_type
 
type  diag_grid
 Contains the coordinates of the local domain to output. More...
 
type  file_type
 Type to define the diagnostic files that will be written as defined by the diagnostic table. More...
 
type  fmsdiagattribute_type
 Type to hold the attributes of the field/axis/file. More...
 
type  input_field_type
 Type to hold the input field description. More...
 
type  output_field_type
 Type to hold the output field description. More...
 

Functions/Subroutines

subroutine diag_data_init ()
 Initialize and write the version number of this file to the log file.
 
subroutine fms_add_attribute (this, att_name, att_value)
 Adds an attribute to the attribute type. More...
 
integer function get_base_day ()
 gets the module variable base_day More...
 
integer function get_base_hour ()
 gets the module variable base_hour More...
 
integer function get_base_minute ()
 gets the module variable base_minute More...
 
integer function get_base_month ()
 gets the module variable base_month More...
 
integer function get_base_second ()
 gets the module variable base_second More...
 
type(time_type) function get_base_time ()
 gets the module variable base_time More...
 
integer function get_base_year ()
 gets the module variable base_year More...
 
integer function get_var_type (var)
 gets the type of a variable More...
 
subroutine set_base_time (base_time_int)
 Set the module variable base_time. More...
 
subroutine write_metadata (this, fileobj, var_name, cell_methods)
 Writes out the attributes from an fmsDiagAttribute_type. More...
 

Variables

logical append_pelist_name = .FALSE.
 
character(len=7) avg_name = 'average'
 Name of the average fields.
 
integer, private base_day
 
integer, private base_hour
 
integer, private base_minute
 
integer, private base_month
 
integer, private base_second
 
type(time_type), private base_time
 The base_time read from diag_table.
 
logical, private base_time_set
 Flag indicating that the base_time is set This is to prevent users from calling set_base_time multiple times.
 
integer, private base_year
 
integer, parameter begin_time = 1
 Use the begining of the time average bounds.
 
real(r8_kind), parameter cmor_missing_value = 1.0e20
 CMOR standard missing value.
 
integer, parameter daily = 24
 
logical debug_diag_manager = .FALSE.
 
integer, parameter diag_all = 2
 
integer, parameter diag_days = 4
 
integer, parameter diag_field_not_found = -1
 Return value for a diag_field that isn't found in the diag_table.
 
integer, parameter diag_hours = 3
 
type(time_typediag_init_time
 Time diag_manager_init called. If init_time not included in diag_manager_init call, then same as base_time.
 
integer diag_log_unit
 
integer, parameter diag_minutes = 2
 
integer, parameter diag_months = 5
 
integer, parameter diag_not_found = -1
 
integer, parameter diag_not_registered = 0
 
character(len=1), parameter diag_null_string = " "
 
integer, parameter diag_ocean = 1
 
integer, parameter diag_other = 0
 
integer, parameter diag_registered_id = 10
 
integer, parameter diag_seconds = 1
 
integer, parameter diag_years = 6
 
integer, parameter direction_down = -1
 The axis points down if positive.
 
integer, parameter direction_up = 1
 The axis points up if positive.
 
integer, parameter diurnal = 2
 
logical do_diag_field_log = .FALSE.
 
real(r8_kind) empty = 0.0
 
integer, parameter end_of_run = -1
 
integer, parameter end_time = 3
 Use the end of the time average bounds.
 
integer, parameter every_time = 0
 
type(fmsnetcdfdomainfile_t), dimension(:), allocatable, target fileobj
 
type(fmsnetcdffile_t), dimension(:), allocatable, target fileobjnd
 
type(fmsnetcdfunstructureddomainfile_t), dimension(:), allocatable, target fileobju
 
type(file_type), dimension(:), allocatable, save files
 
real fill_value = NF_FILL_REAL
 Fill value used. Value will be NF90_FILL_REAL if using the netCDF module, otherwise will be 9.9692099683868690e+36.
 
logical first_send_data_call = .TRUE.
 
logical flush_nc_files = .FALSE.
 Control if diag_manager will force a flush of the netCDF file on each write. Note: changing this to .TRUE. can greatly reduce the performance of the model, as the model must wait until the flush to disk has completed.
 
character(len=2), dimension(:), allocatable fnum_for_domain
 If this file number in the array is for the "unstructured" or "2d" domain.
 
integer, parameter glo_reg_val = -999
 Value used in the region specification of the diag_table to indicate to use the full axis instead of a sub-axis.
 
integer, parameter glo_reg_val_alt = -1
 Alternate value used in the region specification of the diag_table to indicate to use the full axis instead of a sub-axis.
 
character(len=256) global_descriptor
 
integer, parameter i4 = -4
 
integer, parameter i8 = -8
 
integer, parameter index_gridtype = 2
 
type(input_field_type), dimension(:), allocatable input_fields
 
integer, parameter instantaneous = 0
 
integer, parameter is_x_axis = 1
 integer indicating that it is a x axis
 
integer, parameter is_y_axis = 2
 integer indicating that it is a y axis
 
logical issue_oor_warnings = .TRUE.
 Issue warnings if the output field has values outside the given range for a variable.
 
integer, parameter latlon_gridtype = 1
 
integer max_axes = 60
 Maximum number of independent axes.
 
integer max_axis_attributes = 4
 Maximum number of user definable attributes per axis.
 
integer max_field_attributes = 4
 Maximum number of user definable attributes per field. Liptak: Changed from 2 to 4 20170718.
 
integer, parameter max_fields_per_file = 300
 Maximum number of fields per file.
 
integer max_file_attributes = 2
 Maximum number of user definable global attributes per file.
 
integer max_files = 31
 Maximum number of output files allowed. Increase via diag_manager_nml.
 
integer max_input_fields = 600
 Maximum number of input fields. Increase via diag_manager_nml.
 
integer max_num_axis_sets = 25
 
integer max_out_per_in_field = 150
 Maximum number of output_fields per input_field. Increase via diag_manager_nml.
 
integer max_output_fields = 300
 Maximum number of output fields. Increase via diag_manager_nml.
 
integer, parameter max_str_len = 255
 Max length for a string.
 
integer, parameter max_subaxes = 10
 
real(r8_kind) max_value
 
integer, parameter middle_time = 2
 Use the middle of the time average bounds.
 
real(r8_kind) min_value
 
logical mix_snapshot_average_fields =.FALSE.
 
logical module_is_initialized = .FALSE.
 Indicate if diag_manager has been initialized.
 
integer, parameter monthly = 30
 Supported averaging intervals.
 
integer, parameter no_diag_averaging = 0
 
integer, parameter no_domain = 1
 Use the FmsNetcdfFile_t fileobj.
 
character(len=8) no_units = "NO UNITS"
 String indicating that the variable has no units.
 
integer null_axis_id
 
integer, parameter null_gridtype = DIAG_NULL
 
integer, parameter null_type_int = -999
 
integer num_files = 0
 Number of output files currenly in use by the diag_manager.
 
integer num_input_fields = 0
 Number of input fields in use.
 
integer num_output_fields = 0
 Number of output fields in use.
 
integer oor_warning = WARNING
 
logical oor_warnings_fatal = .FALSE.
 Cause a fatal error if the output field has a value outside the given range for a variable.
 
type(output_field_type), dimension(:), allocatable output_fields
 
integer pack_size = 1
 1 for double and 2 for float
 
character(len=6) pack_size_str ="double"
 Pack size as a string to be used in fms2_io register call set to "double" or "float".
 
character(len=32) pelist_name
 
logical prepend_date = .TRUE.
 Should the history file have the start date prepended to the file name. .TRUE. is only supported if the diag_manager_init routine is called with the optional time_init parameter.
 
integer, parameter r4 = 4
 
integer, parameter r8 = 8
 Supported type/kind of the variable.
 
logical region_out_use_alt_value = .TRUE.
 Will determine which value to use when checking a regional output if the region is the full axis or a sub-axis. The values are defined as GLO_REG_VAL (-999) and GLO_REG_VAL_ALT (-1) in diag_data_mod.
 
integer, parameter six_hourly = 6
 
integer, parameter string = 19
 s is the 19th letter of the alphabet
 
integer, parameter sub_regional = 4
 This is a file with a sub_region use the FmsNetcdfFile_t fileobj.
 
integer, parameter three_hourly = 3
 
integer, parameter time_average = 4
 The reduction method is average of values.
 
integer, parameter time_diurnal = 6
 The reduction method is diurnal.
 
integer, parameter time_max = 2
 The reduction method is max value.
 
integer, parameter time_min = 1
 The reduction method is min value.
 
integer, parameter time_none = 0
 There is no reduction method.
 
integer, parameter time_power = 7
 The reduction method is average with exponents.
 
integer, parameter time_rms = 5
 The reudction method is root mean square of values.
 
integer, parameter time_sum = 3
 The reduction method is sum of values.
 
character(len=10), dimension(6) time_unit_list = (/'seconds ', 'minutes ', 'hours ', 'days ', 'months ', 'years '/)
 
type(time_typetime_zero
 
integer, parameter two_d_domain = 2
 Use the FmsNetcdfDomainFile_t fileobj.
 
integer, parameter ug_domain = 3
 Use the FmsNetcdfUnstructuredDomainFile_t fileobj.
 
logical use_clock_average = .false.
 .TRUE. if the averaging of variable is done based on the clock For example, if doing daily averages and your start the simulation in day1_hour3, it will do the average between day1_hour3 to day2_hour 0 the default behavior will do the average between day1 hour3 to day2 hour3
 
logical use_cmor = .FALSE.
 Indicates if we should overwrite the MISSING_VALUE to use the CMOR missing value.
 
logical use_modern_diag = .false.
 Namelist flag to use the modernized diag_manager code.
 
logical use_mpp_io = .false.
 false is fms2_io (default); true is mpp_io
 
logical use_refactored_send = .false.
 Namelist flag to use refactored send_data math funcitons.
 
integer, parameter very_large_axis_length = 10000
 
integer, parameter very_large_file_freq = 100000
 
logical write_bytes_in_file = .FALSE.
 
integer, parameter yearly = 12
 

Detailed Description

Type descriptions and global variables for the diag_manager modules.

Author
Seth Underwood seth..nosp@m.unde.nosp@m.rwood.nosp@m.@noa.nosp@m.a.gov

Notation:

input field

The data structure describing the field as registered by the model code.

output field
The data structure describing the actual diagnostic output with requested frequency and other options.

Input fields, output fields, and output files are gathered in arrays called "input_fields", "output_fields", and "files", respectively. Indices in these arrays are used as pointers to create associations between various data structures.

Each input field associated with one or several output fields via array of indices output_fields; each output field points to the single "parent" input field with the input_field index, and to the output file with the output_file index.


Data Type Documentation

◆ diag_data_mod::coord_type

type diag_data_mod::coord_type

Define the region for field output.

Definition at line 171 of file diag_data.F90.

Collaboration diagram for coord_type:
[legend]

Public Attributes

real xbegin
 
real xend
 
real ybegin
 
real yend
 
real zbegin
 
real zend
 

◆ diag_data_mod::diag_atttype

type diag_data_mod::diag_atttype

Attribute type for diagnostic fields.

Definition at line 157 of file diag_data.F90.

Collaboration diagram for diag_atttype:
[legend]

Public Attributes

character(len=1280) catt
 Character string to hold character value of attribute.
 
real, dimension(:), allocatable fatt
 REAL array to hold value of REAL attributes.
 
integer, dimension(:), allocatable iatt
 INTEGER array to hold value of INTEGER attributes.
 
integer len
 Number of values in attribute, or if a character string then length of the string.
 
character(len=128) name
 Name of the attribute.
 
integer type
 Data type of attribute values (NF_INT, NF_FLOAT, NF_CHAR)
 

◆ diag_data_mod::diag_axis_type

type diag_data_mod::diag_axis_type

Type to hold the diagnostic axis description.

Definition at line 306 of file diag_data.F90.

Collaboration diagram for diag_axis_type:
[legend]

Public Attributes

type(diag_atttype), dimension(:), allocatable attributes
 Array to hold user definable attributes.
 
character(len=128) aux
 
character(len=1) cart_name
 
real, dimension(:), pointer diag_type_data
 
integer direction
 
type(domain1ddomain
 
type(domain2ddomain2
 
integer domain_position
 The position in the doman (NORTH or EAST or CENTER)
 
type(domainugdomainug
 
integer edges
 
integer, dimension(max_subaxes) end
 
integer length
 
character(len=256) long_name
 
character(len=128) name
 
integer num_attributes
 Number of defined attibutes.
 
character(len=128) req
 
integer set
 
integer shift
 
integer, dimension(max_subaxes) start
 
type(domain2d), dimension(max_subaxes) subaxis_domain2
 
character(len=128), dimension(max_subaxes) subaxis_name
 
integer tile_count
 
character(len=256) units
 

◆ diag_data_mod::diag_fieldtype

type diag_data_mod::diag_fieldtype

Diagnostic field type.

Definition at line 146 of file diag_data.F90.

Collaboration diagram for diag_fieldtype:
[legend]

Public Attributes

type(domain2ddomain
 
type(domainugdomainu
 
character(len=128) fieldname
 Fieldname.
 
real miss
 
real miss_pack
 
logical miss_pack_present
 
logical miss_present
 
integer tile_count
 

◆ diag_data_mod::diag_global_att_type

type diag_data_mod::diag_global_att_type

Definition at line 327 of file diag_data.F90.

Collaboration diagram for diag_global_att_type:
[legend]

Public Attributes

character(len=128) grid_type ='regular'
 
character(len=128) tile_name ='N/A'
 

◆ diag_data_mod::diag_grid

type diag_data_mod::diag_grid

Contains the coordinates of the local domain to output.

Definition at line 136 of file diag_data.F90.

Collaboration diagram for diag_grid:
[legend]

Public Attributes

real, dimension(3) end
 end coordinates (lat,lon,depth) of local domain to output
 
integer, dimension(3) l_end_indx
 end indices at each LOCAL PE
 
integer, dimension(3) l_start_indx
 start indices at each LOCAL PE
 
real, dimension(3) start
 start coordinates (lat,lon,depth) of local domain to output
 
integer, dimension(3) subaxes
 id returned from diag_subaxes_init of 3 subaxes
 

◆ diag_data_mod::file_type

type diag_data_mod::file_type

Type to define the diagnostic files that will be written as defined by the diagnostic table.

Definition at line 182 of file diag_data.F90.

Collaboration diagram for file_type:
[legend]

Public Attributes

type(diag_atttype), dimension(:), allocatable attributes
 Array to hold user definable attributes.
 
integer bytes_written
 
type(time_typeclose_time
 Time file closed. File does not allow data after close time.
 
integer duration
 
integer duration_units
 
type(diag_fieldtypef_avg_end
 
type(diag_fieldtypef_avg_nitems
 
type(diag_fieldtypef_avg_start
 
type(diag_fieldtypef_bounds
 
integer, dimension(max_fields_per_file) fields
 
integer file_unit
 
character(len=10) filename_time_bounds
 
integer format
 
logical, allocatable is_time_axis_registered
 
type(time_typelast_flush
 
logical local
 .TRUE. if fields are output in a region instead of global.
 
character(len=128) long_name
 
character(len=fms_file_len) name
 Name of the output file.
 
integer new_file_freq
 frequency to create new file
 
integer new_file_freq_units
 time units of new_file_freq (days, hours, years, ...)
 
type(time_typenext_open
 Time to open a new file.
 
integer num_attributes
 Number of defined attibutes.
 
integer num_fields
 
integer output_freq
 
integer output_units
 
real rtime_current
 
type(time_typestart_time
 Time file opened.
 
integer tile_count
 
integer time_axis_id
 
integer time_bounds_id
 
integer time_index
 
integer time_units
 
logical(i4_kind) use_domain2d = .false.
 
logical(i4_kind) use_domainug = .false.
 

◆ diag_data_mod::fmsdiagattribute_type

type diag_data_mod::fmsdiagattribute_type

Type to hold the attributes of the field/axis/file.

Definition at line 334 of file diag_data.F90.

Collaboration diagram for fmsdiagattribute_type:
[legend]

Public Member Functions

procedure add => fms_add_attribute
 
procedure write_metadata
 

Public Attributes

character(len=:), allocatable att_name
 Name of the attribute.
 
class(*), dimension(:), allocatable att_value
 Value of the attribute.
 

◆ diag_data_mod::input_field_type

type diag_data_mod::input_field_type

Type to hold the input field description.

Definition at line 222 of file diag_data.F90.

Collaboration diagram for input_field_type:
[legend]

Public Attributes

integer active_omp_level
 The current level of OpenMP nesting.
 
integer, dimension(3) axes
 
character(len=128) field_name
 
character(len=64) interp_method
 
logical issued_mask_ignore_warning
 Indicates if the mask_ignore_warning has been issued for this input field. Once .TRUE. the warning message is suppressed on all subsequent send_data calls.
 
logical local
 
type(coord_typelocal_coord
 
character(len=128) long_name
 
logical mask_variant
 
real missing_value
 
logical missing_value_present
 
character(len=128) module_name
 
integer num_axes
 
integer num_output_fields
 
integer numthreads
 
integer, dimension(:), allocatable output_fields
 
real, dimension(2) range
 
logical range_present
 
logical register
 
integer, dimension(3) size
 
character(len=256) standard_name
 
logical static
 
integer tile_count
 
type(time_typetime
 
character(len=128) units
 

◆ diag_data_mod::output_field_type

type diag_data_mod::output_field_type

Type to hold the output field description.

Definition at line 249 of file diag_data.F90.

Collaboration diagram for output_field_type:
[legend]

Public Attributes

type(diag_atttype), dimension(:), allocatable attributes
 
integer, dimension(4) axes
 
type(fmsdiagibounds_typebuff_bounds
 
real, dimension(:,:,:,:), allocatable buffer
 coordinates of the buffer and counter are (x, y, z, time-of-day)
 
real, dimension(:), allocatable count_0d
 the following two counters are used in time-averaging for some combination of the field options. Their size is the length of the diurnal axis; the counters must be tracked separately for each of the diurnal interval, because the number of time slices accumulated in each can be different, depending on time step and the number of diurnal samples.
 
real, dimension(:,:,:,:), allocatable counter
 coordinates of the buffer and counter are (x,y,z,time-of-day)
 
type(diag_fieldtypef_type
 
integer input_field
 index of the corresponding input field in the table
 
type(time_typelast_output
 
logical local_output
 
integer n_diurnal_samples
 number of diurnal sample intervals, 1 or more
 
logical need_compute
 
type(time_typenext_next_output
 
type(time_typenext_output
 
integer num_attributes
 
integer num_axes
 
integer, dimension(:), allocatable num_elements
 the following two counters are used in time-averaging for some combination of the field options. Their size is the length of the diurnal axis; the counters must be tracked separately for each of the diurnal interval, because the number of time slices accumulated in each can be different, depending on time step and the number of diurnal samples.
 
integer output_file
 index of the output file in the table
 
type(diag_gridoutput_grid
 
character(len=128) output_name
 
integer pack
 
logical phys_window
 
integer pow_value
 Power value to use for mean_pow(n) calculations.
 
logical reduced_k_range
 
logical reduced_k_unstruct = .false.
 
integer region_elements
 
logical static
 
logical time_average
 true if the output field is averaged over time interval
 
logical time_max
 true if the output field is maximum over time interval
 
character(len=50) time_method
 time method field from the input file
 
logical time_min
 true if the output field is minimum over time interval
 
type(time_typetime_of_prev_field_data
 
logical time_ops
 true if any of time_min, time_max, time_rms or time_average is true
 
logical time_rms
 true if the output field is the rms. If true, then time_average is also
 
logical time_sum
 true if the output field is summed over time interval
 
integer total_elements
 
logical written_once
 

Function/Subroutine Documentation

◆ fms_add_attribute()

subroutine diag_data_mod::fms_add_attribute ( class(fmsdiagattribute_type), intent(inout)  this,
character(len=*), intent(in)  att_name,
class(*), dimension(:), intent(in)  att_value 
)

Adds an attribute to the attribute type.

Parameters
[in,out]thisDiag attribute type
[in]att_nameName of the attribute
[in]att_valueThe attribute value to add

Definition at line 564 of file diag_data.F90.

◆ get_base_day()

integer function diag_data_mod::get_base_day

gets the module variable base_day

Returns
the base_day

Definition at line 533 of file diag_data.F90.

◆ get_base_hour()

integer function diag_data_mod::get_base_hour

gets the module variable base_hour

Returns
the base_hour

Definition at line 541 of file diag_data.F90.

◆ get_base_minute()

integer function diag_data_mod::get_base_minute

gets the module variable base_minute

Returns
the base_minute

Definition at line 549 of file diag_data.F90.

◆ get_base_month()

integer function diag_data_mod::get_base_month

gets the module variable base_month

Returns
the base_month

Definition at line 525 of file diag_data.F90.

◆ get_base_second()

integer function diag_data_mod::get_base_second

gets the module variable base_second

Returns
the base_second

Definition at line 557 of file diag_data.F90.

◆ get_base_time()

type(time_type) function diag_data_mod::get_base_time

gets the module variable base_time

Returns
the base_time

Definition at line 509 of file diag_data.F90.

◆ get_base_year()

integer function diag_data_mod::get_base_year

gets the module variable base_year

Returns
the base_year

Definition at line 517 of file diag_data.F90.

◆ get_var_type()

integer function diag_data_mod::get_var_type ( class(*), intent(in)  var)

gets the type of a variable

Returns
the type of the variable (r4,r8,i4,i8,string)
Parameters
[in]varVariable to get the type for
Returns
The variable's type

Definition at line 597 of file diag_data.F90.

◆ set_base_time()

subroutine diag_data_mod::set_base_time ( integer, dimension(6)  base_time_int)

Set the module variable base_time.

Parameters
base_time_intbase_time as an array [year month day hour min sec]

Definition at line 462 of file diag_data.F90.

◆ write_metadata()

subroutine diag_data_mod::write_metadata ( class(fmsdiagattribute_type), intent(inout)  this,
class(fmsnetcdffile_t), intent(inout)  fileobj,
character(len=*), intent(in)  var_name,
character(len=*), intent(inout), optional  cell_methods 
)

Writes out the attributes from an fmsDiagAttribute_type.

Parameters
[in,out]thisDiag attribute type
[in,out]fileobjFms2_io fileobj to write to
[in]var_nameThe name of the variable to write to
[in,out]cell_methodsThe cell methods attribute
[in,out]cell_methodsIf the attribute is cell methods append to the current cell_methods attribute value This will be writen once all of the cell_methods attributes are gathered ...

Definition at line 620 of file diag_data.F90.