FMS
2024.03
Flexible Modeling System
|
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. More...
Functions/Subroutines | |
subroutine, public | diag_field_write (varname, buffer, static, file_num, fileobjU, fileobj, fileobjND, fnum_for_domain, time_in) |
Writes diagnostic data out using fms2_io routine. More... | |
subroutine, public | diag_flush (file_num, fileobjU, fileobj, fileobjND, fnum_for_domain) |
Flushes the file into disk. More... | |
subroutine, public | diag_output_init (file_name, file_title, file_unit, domain, domainU, fileobj, fileobjU, fileobjND, fnum_domain, attributes) |
Opens the output file. More... | |
subroutine, public | diag_write_time (fileob, rtime_value, time_index, time_name) |
Writes the time data to the history file. More... | |
subroutine, public | done_meta_data (file_unit) |
Writes axis data to file. More... | |
integer function | get_axis_index (num) |
Return the axis index number. More... | |
subroutine, public | get_diag_global_att (gAtt) |
Return the global attribute type. | |
subroutine, public | set_diag_global_att (component, gridType, tileName) |
Set the global attribute type. | |
subroutine | write_attribute_meta (file_unit, num_attributes, attributes, time_method, err_msg, varname, fileob) |
Write out attribute meta data to file. More... | |
subroutine, public | write_axis_meta_data (file_unit, axes, fileob, time_ops, time_axis_registered) |
Write the axis meta data to file. More... | |
type(diag_fieldtype) function, public | write_field_meta_data (file_unit, name, axes, units, long_name, range, pack, mval, avg_name, time_method, standard_name, interp_method, attributes, num_attributes, use_UGdomain, fileob) |
Write the field meta data to file. More... | |
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.
subroutine, public diag_output_mod::diag_field_write | ( | character(len=*), intent(in) | varname, |
real, dimension(:,:,:,:), intent(inout) | buffer, | ||
logical, intent(in) | static, | ||
integer, intent(in) | file_num, | ||
type(fmsnetcdfunstructureddomainfile_t), dimension(:), intent(inout) | fileobjU, | ||
type(fmsnetcdfdomainfile_t), dimension(:), intent(inout) | fileobj, | ||
type(fmsnetcdffile_t), dimension(:), intent(inout) | fileobjND, | ||
character(len=2), intent(in) | fnum_for_domain, | ||
integer, intent(in), optional | time_in | ||
) |
Writes diagnostic data out using fms2_io routine.
[in] | varname | Variable name |
[in,out] | buffer | Buffer containing the variable data |
[in] | static | Flag indicating if a variable is static |
[in] | file_num | Index in the fileobj* types array |
[in,out] | fileobju | Array of non domain decomposed fileobj |
[in,out] | fileobj | Array of domain decomposed fileobj |
[in,out] | fileobjnd | Array of unstructured domain fileobj |
[in] | fnum_for_domain | String indicating the type of domain "2d" domain decomposed "ug" unstructured domain decomposed "nd" no domain |
[in] | time_in | Time index |
Set up the time. Static field and default time is 0
If the variable is 1D, switch the buffer so that n_diurnal_samples is the second dimension (nx, n_diurnal_samples, 1, 1)
If the variable is 2D, switch the n_diurnal_samples and nz dimension, so local_buffer has dimension (nx, ny, n_diurnal_samples, 1).
Figure out which file object to write output to
Definition at line 802 of file diag_output.F90.
subroutine, public diag_output_mod::diag_flush | ( | integer, intent(in) | file_num, |
type(fmsnetcdfunstructureddomainfile_t), dimension(:), intent(inout) | fileobjU, | ||
type(fmsnetcdfdomainfile_t), dimension(:), intent(inout) | fileobj, | ||
type(fmsnetcdffile_t), dimension(:), intent(inout) | fileobjND, | ||
character(len=2), intent(in) | fnum_for_domain | ||
) |
Flushes the file into disk.
[in] | file_num | Index in the fileobj* types array |
[in,out] | fileobju | Array of non domain decomposed fileobj |
[in,out] | fileobj | Array of domain decomposed fileobj |
[in,out] | fileobjnd | Array of unstructured domain fileobj |
[in] | fnum_for_domain | String indicating the type of domain "2d" domain decomposed "ug" unstructured domain decomposed "nd" no domain |
Definition at line 930 of file diag_output.F90.
subroutine, public diag_output_mod::diag_output_init | ( | character(len=*), intent(in) | file_name, |
character(len=*), intent(in) | file_title, | ||
integer, intent(out) | file_unit, | ||
type(domain2d), intent(in) | domain, | ||
type(domainug), intent(in) | domainU, | ||
type(fmsnetcdfdomainfile_t), intent(inout), target | fileobj, | ||
type(fmsnetcdfunstructureddomainfile_t), intent(inout), target | fileobjU, | ||
type(fmsnetcdffile_t), intent(inout), target | fileobjND, | ||
character(*), intent(out) | fnum_domain, | ||
type(diag_atttype), dimension(:), intent(in), optional | attributes | ||
) |
Opens the output file.
[in] | file_name | Output file name |
[in] | file_title | Descriptive title for the file |
[out] | file_unit | File unit number assigned to the output file. Needed for subsuquent calls to diag_output_mod |
[in] | domain | Domain associated with file, if domain decomposed |
[in] | domainu | The unstructure domain |
[in,out] | fileobj | Domain decomposed fileobj |
[in,out] | fileobju | Unstructured domain fileobj |
[in,out] | fileobjnd | Non domain decomposed fileobj |
[out] | fnum_domain | String indicating the type of fileobj was used: "2d" domain decomposed "ug" unstrucuted domain decomposed "nd" no domain |
[in] | attributes | Array of global attributes to be written to file |
Checks to make sure that only domain2D or domainUG is used. If both are not null, then FATAL
Check if there is an io_domain
Definition at line 87 of file diag_output.F90.
subroutine, public diag_output_mod::diag_write_time | ( | class(fmsnetcdffile_t), intent(inout) | fileob, |
real, intent(in) | rtime_value, | ||
integer, intent(in) | time_index, | ||
character(len=*), intent(in), optional | time_name | ||
) |
Writes the time data to the history file.
[in,out] | fileob | fms2_io file object |
[in] | rtime_value | The value of time to be written |
[in] | time_index | The index of the time variable |
[in] | time_name | The name of the time variable |
Get the name of the time variable
Write the time data
Cleanup
Definition at line 865 of file diag_output.F90.
subroutine, public diag_output_mod::done_meta_data | ( | integer, intent(in) | file_unit | ) |
Writes axis data to file.
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.
[in] | file_unit | Output file unit number |
Definition at line 794 of file diag_output.F90.
|
private |
|
private |
Write out attribute meta data to file.
Write out the attribute meta data to file, for field and axes
[in] | file_unit | File unit number |
[in] | num_attributes | Number of attributes to write |
[in] | attributes | Array of attributes |
[in] | time_method | To include in cell_methods attribute if present |
[out] | err_msg | Return error message |
[in] | varname | The name of the variable |
[in,out] | fileob | FMS2_io fileobj |
Definition at line 732 of file diag_output.F90.
subroutine, public diag_output_mod::write_axis_meta_data | ( | integer, intent(in) | file_unit, |
integer, dimension(:), intent(in) | axes, | ||
class(fmsnetcdffile_t), intent(inout) | fileob, | ||
logical, intent(in), optional | time_ops, | ||
logical, intent(inout), optional | time_axis_registered | ||
) |
Write the axis meta data to file.
[in] | file_unit | File unit number |
[in] | axes | Array of axis ID's, including the time axis |
[in,out] | fileob | FMS2_io fileobj |
[in] | time_ops | .TRUE. if this file contains any min, max, time_rms, or time_average |
[in,out] | time_axis_registered | .TRUE. if the time axis was already written to the file |
If the axis is domain decomposed and the type is FmsNetcdfFile_t, this is regional diagnostic So treat it as any other dimension
For regional subaxis add the "domain_decomposition" attribute, which is added fms2_io for (other) domains with sufficient decomposition info.
If the axis is domain decomposed and the type is FmsNetcdfDomainFile_t, this is a domain decomposed dimension so register it as one
If the axis is in unstructured domain and the type is FmsNetcdfUnstructuredDomainFile_t, this is an unstrucutred axis so register it as one
If the axis is not in a domain, register it as a normal dimension
Add the attributes
If not a time axis, add the positive attribute and write the data
Write additional axis attributes, from diag_axis_add_attribute calls
Write additional attribute (calendar_type) for time axis -—
Deallocate attributes
Add edges axis with fms2_io
Definition at line 210 of file diag_output.F90.
type(diag_fieldtype) function, public diag_output_mod::write_field_meta_data | ( | integer, intent(in) | file_unit, |
character(len=*), intent(in) | name, | ||
integer, dimension(:), intent(in) | axes, | ||
character(len=*), intent(in) | units, | ||
character(len=*), intent(in) | long_name, | ||
real, dimension(2), intent(in), optional | range, | ||
integer, intent(in), optional | pack, | ||
real, intent(in), optional | mval, | ||
character(len=*), intent(in), optional | avg_name, | ||
character(len=*), intent(in), optional | time_method, | ||
character(len=*), intent(in), optional | standard_name, | ||
character(len=*), intent(in), optional | interp_method, | ||
type(diag_atttype), dimension(:), intent(in), optional, allocatable | attributes, | ||
integer, intent(in), optional | num_attributes, | ||
logical, intent(in), optional | use_UGdomain, | ||
class(fmsnetcdffile_t), intent(inout) | fileob | ||
) |
Write the field meta data to file.
The meta data for the field is written to the file indicated by file_unit
[in] | file_unit | Output file unit number | ||||||||||
[in] | axes | Array of axis IDs | ||||||||||
[in] | name | Field name | ||||||||||
[in] | units | Field units | ||||||||||
[in] | long_name | Field's long name | ||||||||||
[in] | range | Valid range (min, max). If min > max, the range will be ignored | ||||||||||
[in] | mval | Missing value, must be within valid range | ||||||||||
[in] | pack | Packing flag. Only valid when range specified. Valid values:
| ||||||||||
[in] | avg_name | Name of variable containing time averaging info | ||||||||||
[in] | time_method | Name of transformation applied to the time-varying data, i.e. "avg", "min", "max" | ||||||||||
[in] | standard_name | Standard name of field |
Definition at line 468 of file diag_output.F90.