FMS  2024.01.00
Flexible Modeling System
diag_axis_mod

An integral part of diag_manager_mod. It helps to create axis IDs that are used in register_diag_field. More...

Data Types

interface  diag_axis_add_attribute
 Add an arbitrary attribute and value to the diagnostic axis. More...
 

Functions/Subroutines

subroutine attribute_init_axis (out_axis, err_msg)
 Allocates memory in out_file for the attributes. Will FATAL if err_msg is not included in the subroutine call. More...
 
integer(i4_kind) function, public axis_compatible_check (id, varname)
 Checks if the axes are compatible. More...
 
logical function, public axis_is_compressed (id)
 given an axis, returns TRUE if the axis uses compression-by-gathering: that is, if this is an axis for fields on unstructured grid More...
 
subroutine diag_axis_add_attribute_i1d (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_r1d (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_c (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_i (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_r (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_attribute_init (diag_axis_id, name, type, cval, ival, rval)
 
integer function, public diag_axis_init (name, array_data, units, cart_name, long_name, direction, set_name, edges, Domain, Domain2, DomainU, aux, req, tile_count, domain_position)
 Initialize the axis, and return the axis ID. More...
 
integer function, public diag_subaxes_init (axis, subdata, start_indx, end_indx, domain_2d)
 Create a subaxis on a parent axis. More...
 
subroutine, public get_axes_shift (ids, ishift, jshift)
 Return the value of the shift for the axis IDs given. More...
 
character(len=128) function, public get_axis_aux (id)
 Return the auxiliary name for the axis. More...
 
integer function, public get_axis_global_length (id)
 Return the global length of the axis. More...
 
integer function, public get_axis_length (id)
 Return the length of the axis. More...
 
integer function, public get_axis_num (axis_name, set_name)
 Returns index into axis table corresponding to a given axis name. More...
 
character(len=128) function, public get_axis_reqfld (id)
 Return the required field names for the axis. More...
 
integer function get_axis_set_num (set_name)
 Returns index in axis set table corresponding to a given axis set name. More...
 
subroutine, public get_compressed_axes_ids (id, r)
 given an index of compressed-by-gathering axis, return an array of axes used in compression. It is a fatal error to call it on axis that is not compressed
 
subroutine, public get_diag_axis (id, name, units, long_name, cart_name, direction, edges, Domain, DomainU, array_data, num_attributes, attributes, domain_position)
 Return information about the axis with index ID. More...
 
subroutine, public get_diag_axis_cart (id, cart_name)
 Return the axis cartesian. More...
 
subroutine, public get_diag_axis_data (id, axis_data)
 Return the axis data. More...
 
subroutine, public get_diag_axis_domain_name (id, name)
 Return the name of the axis' domain. More...
 
subroutine, public get_diag_axis_name (id, axis_name)
 Return the short name of the axis. More...
 
type(domain1d) function, public get_domain1d (id)
 Retrun the 1D domain for the axis ID given. More...
 
type(domain2d) function, public get_domain2d (ids)
 Return the 2D domain for the axis IDs given. More...
 
type(domainug) function, public get_domainug (id)
 Retrun the 1D domain for the axis ID given. More...
 
integer function, public get_tile_count (ids)
 Return the tile count for the axis. More...
 
subroutine prepend_attribute_axis (out_axis, att_name, prepend_value, err_msg)
 Prepends the attribute value to an already existing attribute. If the attribute isn't yet defined, then creates a new attribute. More...
 
subroutine valid_id_check (id, routine_name)
 Check to see if the given axis id is a valid id. If the axis id is invalid, call a FATAL error. If the ID is valid, just return. More...
 

Variables

type(diag_axis_type), dimension(:), allocatable, save axes
 global storage for all defined axes
 
character(len=128), dimension(:), allocatable, save axis_sets
 storage for axis set names
 
integer(i4_kind), parameter, public diag_axis_2ddomain = 1
 For unstructured grid support.
 
integer(i4_kind), parameter, public diag_axis_ugdomain = 2
 For unstructured grid support.
 
logical module_is_initialized = .FALSE.
 
integer num_axis_sets = 0
 
integer num_def_axes = 0
 
integer, dimension(:), allocatable num_subaxes
 counter of number of axes defined
 

Detailed Description

An integral part of diag_manager_mod. It helps to create axis IDs that are used in register_diag_field.

Author
Seth Underwood

Users first create axis ID by calling diag_axis_init, then use this axis ID in register_diag_field.


Data Type Documentation

◆ diag_axis_mod::diag_axis_add_attribute

interface diag_axis_mod::diag_axis_add_attribute

Add an arbitrary attribute and value to the diagnostic axis.

Any number of attributes can be added to a given axis. All attribute addition must be done before first send_data call.

If a real or integer attribute is already defined, a FATAL error will be called. If a character attribute is already defined, then it will be prepended to the existing attribute value.
Example usage:

call diag_axis_add_attribute(diag_axis_id, att_name, att_value)

Definition at line 89 of file diag_axis.F90.

Private Member Functions

subroutine diag_axis_add_attribute_i1d (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_r1d (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_c (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_i (diag_axis_id, att_name, att_value)
 
subroutine diag_axis_add_attribute_scalar_r (diag_axis_id, att_name, att_value)
 

Function/Subroutine Documentation

◆ attribute_init_axis()

subroutine diag_axis_mod::attribute_init_axis ( type(diag_axis_type), intent(inout)  out_axis,
character(len=*), intent(out), optional  err_msg 
)
private

Allocates memory in out_file for the attributes. Will FATAL if err_msg is not included in the subroutine call.

Parameters
[in,out]out_axisoutput file to allocate memory for attribute
[out]err_msgError message, passed back to calling function

Definition at line 1122 of file diag_axis.F90.

◆ axis_compatible_check()

integer(i4_kind) function, public diag_axis_mod::axis_compatible_check ( integer, dimension(:), intent(in)  id,
character(*), intent(in), optional  varname 
)

Checks if the axes are compatible.

Returns
integer domain_type
Parameters
[in]idThe array of axis IDs
[in]varnameThe name of the variable
Returns
DIAG_AXIS_NODOMAIN = no domain. DIAG_AXIS_2DDOMAIN = structured domain. DIAG_AXIS_UGDOMAIN = unstructured domain.

Definition at line 744 of file diag_axis.F90.

◆ axis_is_compressed()

logical function, public diag_axis_mod::axis_is_compressed ( integer, intent(in)  id)

given an axis, returns TRUE if the axis uses compression-by-gathering: that is, if this is an axis for fields on unstructured grid

Returns
logical whether or not the axis uses compression-by-gathering

Definition at line 1241 of file diag_axis.F90.

◆ diag_axis_attribute_init()

subroutine diag_axis_mod::diag_axis_attribute_init ( integer, intent(in)  diag_axis_id,
character(len=*)  name,
integer, intent(in)  type,
character(len=*), intent(in), optional  cval,
integer, dimension(:), intent(in), optional  ival,
real, dimension(:), intent(in), optional  rval 
)
private
Parameters
[in]diag_axis_idinput field ID, obtained from diag_axis_mod::diag_axis_init.
nameName of the attribute
[in]typeNetCDF type (NF_FLOAT, NF_INT, NF_CHAR)
[in]cvalCharacter string attribute value
[in]ivalInteger attribute value(s)
[in]rvalReal attribute value(s)

Definition at line 900 of file diag_axis.F90.

◆ diag_axis_init()

integer function, public diag_axis_mod::diag_axis_init ( character(len=*), intent(in)  name,
class(*), dimension(:), intent(in)  array_data,
character(len=*), intent(in)  units,
character(len=*), intent(in)  cart_name,
character(len=*), intent(in), optional  long_name,
integer, intent(in), optional  direction,
character(len=*), intent(in), optional  set_name,
integer, intent(in), optional  edges,
type(domain1d), intent(in), optional  Domain,
type(domain2d), intent(in), optional  Domain2,
type(domainug), intent(in), optional  DomainU,
character(len=*), intent(in), optional  aux,
character(len=*), intent(in), optional  req,
integer, intent(in), optional  tile_count,
integer, intent(in), optional  domain_position 
)

Initialize the axis, and return the axis ID.

diag_axis_init initializes an axis and returns the axis ID that is to be used with register_diag_field. This function also increments the axis counter and fills in the axes

Returns
integer axis ID
Parameters
[in]nameShort name for axis
[in]array_dataArray of coordinate values
[in]unitsUnits for the axis
[in]cart_nameCartesian axis ("X", "Y", "Z", "T")
[in]long_nameLong name for the axis.
[in]directionIndicates the direction of the axis
[in]edgesAxis ID for the previously defined "edges axis"
[in]auxAuxiliary name, can only be geolon_t or geolat_t
[in]reqRequired field names.

Definition at line 109 of file diag_axis.F90.

◆ diag_subaxes_init()

integer function, public diag_axis_mod::diag_subaxes_init ( integer, intent(in)  axis,
real, dimension(:), intent(in)  subdata,
integer, intent(in)  start_indx,
integer, intent(in)  end_indx,
type(domain2d), intent(in), optional  domain_2d 
)

Create a subaxis on a parent axis.

Given the ID of a parent axis, create a subaxis and fill it with data, and return the ID of the corresponding subaxis.

The subaxis is defined on the parent axis from start_indx to end_indx.

Returns
Integer ID of the corresponding subaxis.
Parameters
[in]axisID of the parent axis
[in]subdataData of the subaxis
[in]start_indxStart index of the subaxis
[in]end_indxEnd index of the subaxis

Definition at line 382 of file diag_axis.F90.

◆ get_axes_shift()

subroutine, public diag_axis_mod::get_axes_shift ( integer, dimension(:), intent(in)  ids,
integer, intent(out)  ishift,
integer, intent(out)  jshift 
)

Return the value of the shift for the axis IDs given.

Parameters
[out]ishiftX shift value.
[out]jshiftY shift value.

Definition at line 822 of file diag_axis.F90.

◆ get_axis_aux()

character(len=128) function, public diag_axis_mod::get_axis_aux ( integer, intent(in)  id)

Return the auxiliary name for the axis.

Returns
auxiliary name for the axis
Parameters
[in]idAxis ID

Definition at line 631 of file diag_axis.F90.

◆ get_axis_global_length()

integer function, public diag_axis_mod::get_axis_global_length ( integer, intent(in)  id)

Return the global length of the axis.

Returns
global length of the axis
Parameters
[in]idAxis ID

Definition at line 649 of file diag_axis.F90.

◆ get_axis_length()

integer function, public diag_axis_mod::get_axis_length ( integer, intent(in)  id)

Return the length of the axis.

Returns
length of axis as an integer
Parameters
[in]idAxis ID

Definition at line 611 of file diag_axis.F90.

◆ get_axis_num()

integer function, public diag_axis_mod::get_axis_num ( character(len=*), intent(in)  axis_name,
character(len=*), intent(in), optional  set_name 
)

Returns index into axis table corresponding to a given axis name.

Returns
Returns index into axis table corresponding to a given axis name.
Parameters
[in]axis_nameAxis name
[in]set_nameSet name

Definition at line 846 of file diag_axis.F90.

◆ get_axis_reqfld()

character(len=128) function, public diag_axis_mod::get_axis_reqfld ( integer, intent(in)  id)

Return the required field names for the axis.

Returns
required field names for the axis
Parameters
[in]idAxis ID

Definition at line 640 of file diag_axis.F90.

◆ get_axis_set_num()

integer function diag_axis_mod::get_axis_set_num ( character(len=*), intent(in)  set_name)
private

Returns index in axis set table corresponding to a given axis set name.

Returns
Returns index in axis set table corresponding to a given axis set name
Parameters
[in]set_nameSet name

Definition at line 868 of file diag_axis.F90.

◆ get_diag_axis()

subroutine, public diag_axis_mod::get_diag_axis ( integer, intent(in)  id,
character(len=*), intent(out)  name,
character(len=*), intent(out)  units,
character(len=*), intent(out)  long_name,
character(len=*), intent(out)  cart_name,
integer, intent(out)  direction,
integer, intent(out)  edges,
type(domain1d), intent(out)  Domain,
type(domainug), intent(out)  DomainU,
class(*), dimension(:), intent(out)  array_data,
integer, intent(out), optional  num_attributes,
type(diag_atttype), dimension(:), intent(out), optional, allocatable  attributes,
integer, intent(out), optional  domain_position 
)

Return information about the axis with index ID.

Parameters
[in]idAxis ID
[out]directionDirection of data. (See diag_axis_init for a description of allowed values)
[out]edgesAxis ID for the previously defined "edges axis".
[out]array_dataArray of coordinate values for this axis.

Definition at line 466 of file diag_axis.F90.

◆ get_diag_axis_cart()

subroutine, public diag_axis_mod::get_diag_axis_cart ( integer, intent(in)  id,
character(len=*), intent(out)  cart_name 
)

Return the axis cartesian.

Parameters
[in]idAxis ID
[out]cart_nameCartesian axis

Definition at line 565 of file diag_axis.F90.

◆ get_diag_axis_data()

subroutine, public diag_axis_mod::get_diag_axis_data ( integer, intent(in)  id,
real, dimension(:), intent(out)  axis_data 
)

Return the axis data.

Parameters
[in]idAxis ID
[out]axis_dataAxis data

Definition at line 574 of file diag_axis.F90.

◆ get_diag_axis_domain_name()

subroutine, public diag_axis_mod::get_diag_axis_domain_name ( integer, intent(in)  id,
character(len=*), intent(out)  name 
)

Return the name of the axis' domain.

Parameters
[in]idAxis ID
[out]nameAxis' domain name

Definition at line 601 of file diag_axis.F90.

◆ get_diag_axis_name()

subroutine, public diag_axis_mod::get_diag_axis_name ( integer, intent(in)  id,
character(len=*), intent(out)  axis_name 
)

Return the short name of the axis.

Parameters
[in]idAxis ID
[out]axis_nameAxis short name

Definition at line 588 of file diag_axis.F90.

◆ get_domain1d()

type(domain1d) function, public diag_axis_mod::get_domain1d ( integer, intent(in)  id)

Retrun the 1D domain for the axis ID given.

Returns
1D domain for the axis ID given
Parameters
[in]idAxis ID

Definition at line 685 of file diag_axis.F90.

◆ get_domain2d()

type(domain2d) function, public diag_axis_mod::get_domain2d ( integer, dimension(:), intent(in)  ids)

Return the 2D domain for the axis IDs given.

Returns
2D domain for the axis IDs given
Parameters
[in]idsAxis IDs. Possible dimensions: 1 <= size(ids(:)) <= 4.

Definition at line 698 of file diag_axis.F90.

◆ get_domainug()

type(domainug) function, public diag_axis_mod::get_domainug ( integer, intent(in)  id)

Retrun the 1D domain for the axis ID given.

Returns
1D domain for the axis ID given
Parameters
[in]idAxis ID

Definition at line 730 of file diag_axis.F90.

◆ get_tile_count()

integer function, public diag_axis_mod::get_tile_count ( integer, dimension(:), intent(in)  ids)

Return the tile count for the axis.

Returns
tile count for the axis
Parameters
[in]idsAxis IDs. Possible dimensions: 1 <= size(ids(:)) <= 4.

Definition at line 658 of file diag_axis.F90.

◆ prepend_attribute_axis()

subroutine diag_axis_mod::prepend_attribute_axis ( type(diag_axis_type), intent(inout)  out_axis,
character(len=*), intent(in)  att_name,
character(len=*), intent(in)  prepend_value,
character(len=*), intent(out), optional  err_msg 
)
private

Prepends the attribute value to an already existing attribute. If the attribute isn't yet defined, then creates a new attribute.

Parameters
[in,out]out_axisdiagnostic axis that will get the attribute
[in]att_nameName of the attribute
[in]prepend_valueValue to prepend
[out]err_msgError message, passed back to calling routine

Definition at line 1151 of file diag_axis.F90.

◆ valid_id_check()

subroutine diag_axis_mod::valid_id_check ( integer, intent(in)  id,
character(len=*), intent(in)  routine_name 
)
private

Check to see if the given axis id is a valid id. If the axis id is invalid, call a FATAL error. If the ID is valid, just return.

Parameters
[in]idAxis is to check for validity
[in]routine_nameName of the subroutine checking for a valid axis id

Definition at line 884 of file diag_axis.F90.