namespace mom_diag_mediator¶
Overview¶
The subroutines here provide convenient wrappers to the fms diag_manager interfaces with additional diagnostic capabilies. More…
namespace mom_diag_mediator { // interfaces interface downsample_diag_field; interface downsample_field; interface downsample_mask; interface post_data; // global variables integer id_clock_diag_mediator; integer psp =121; // global functions subroutine, public set_axes_info( G G, GV GV, US US, param_file param_file, diag_cs diag_cs, set_vertical set_vertical ); subroutine, public set_masks_for_axes(G G, diag_cs diag_cs); subroutine, public diag_register_area_ids(diag_cs diag_cs, id_area_t id_area_t, id_area_q id_area_q); subroutine, public register_cell_measure(G G, diag diag, Time Time); subroutine, public diag_associate_volume_cell_measure(diag_cs diag_cs, id_h_volume id_h_volume); integer function, public diag_get_volume_cell_measure_dm_id(diag_cs diag_cs); subroutine, public define_axes_group( diag_cs diag_cs, handles handles, axes axes, nz nz, vertical_coordinate_number vertical_coordinate_number, x_cell_method x_cell_method, y_cell_method y_cell_method, v_cell_method v_cell_method, is_h_point is_h_point, is_q_point is_q_point, is_u_point is_u_point, is_v_point is_v_point, is_layer is_layer, is_interface is_interface, is_native is_native, needs_remapping needs_remapping, needs_interpolating needs_interpolating, xyave_axes xyave_axes ); subroutine, public set_diag_mediator_grid(G G, diag_cs diag_cs); subroutine, public post_data_1d_k( diag_field_id diag_field_id, field field, diag_cs diag_cs, is_static is_static ); subroutine, public enable_averaging( time_int_in time_int_in, time_end_in time_end_in, diag_cs diag_cs ); subroutine, public disable_averaging(diag_cs diag_cs); logical function, public query_averaging_enabled(diag_cs diag_cs, time_int time_int, time_end time_end); type(time_type) function, public get_diag_time_end(diag_cs diag_cs); integer function, public register_diag_field( module_name module_name, field_name field_name, axes_in axes_in, init_time init_time, long_name long_name, units units, missing_value missing_value, range range, mask_variant mask_variant, standard_name standard_name, verbose verbose, do_not_log do_not_log, err_msg err_msg, interp_method interp_method, tile_count tile_count, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name, cell_methods cell_methods, x_cell_method x_cell_method, y_cell_method y_cell_method, v_cell_method v_cell_method, conversion conversion, v_extensive v_extensive ); integer function, public register_scalar_field( module_name module_name, field_name field_name, init_time init_time, diag_cs diag_cs, long_name long_name, units units, missing_value missing_value, range range, standard_name standard_name, do_not_log do_not_log, err_msg err_msg, interp_method interp_method, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name ); integer function, public register_static_field( module_name module_name, field_name field_name, axes axes, long_name long_name, units units, missing_value missing_value, range range, mask_variant mask_variant, standard_name standard_name, do_not_log do_not_log, interp_method interp_method, tile_count tile_count, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name, area area, x_cell_method x_cell_method, y_cell_method y_cell_method, area_cell_method area_cell_method, conversion conversion ); integer function, public ocean_register_diag(var_desc var_desc, G G, diag_CS diag_CS, day day); subroutine, public diag_mediator_infrastructure_init(err_msg err_msg); subroutine, public diag_mediator_init( G G, GV GV, US US, nz nz, param_file param_file, diag_cs diag_cs, doc_file_dir doc_file_dir ); subroutine, public diag_set_state_ptrs(h h, T T, S S, eqn_of_state eqn_of_state, diag_cs diag_cs); subroutine, public diag_update_remap_grids(diag_cs diag_cs, alt_h alt_h, alt_T alt_T, alt_S alt_S); subroutine, public diag_masks_set(G G, nz nz, diag_cs diag_cs); subroutine, public diag_mediator_close_registration(diag_CS diag_CS); subroutine, public diag_mediator_end( time time, diag_CS diag_CS, end_diag_manager end_diag_manager ); subroutine, public diag_grid_storage_init(grid_storage grid_storage, G G, diag diag); subroutine, public diag_copy_diag_to_storage(grid_storage grid_storage, h_state h_state, diag diag); subroutine, public diag_copy_storage_to_diag(diag diag, grid_storage grid_storage); subroutine, public diag_save_grids(diag diag); subroutine, public diag_restore_grids(diag diag); subroutine, public diag_grid_storage_end(grid_storage grid_storage); } // namespace mom_diag_mediator
Detailed Documentation¶
The subroutines here provide convenient wrappers to the fms diag_manager interfaces with additional diagnostic capabilies.
Global Variables¶
integer id_clock_diag_mediator
Sets up diagnostics axes.
Parameters:
g |
Ocean grid structure |
gv |
ocean vertical grid structure |
us |
A dimensional unit scaling type |
param_file |
Parameter file structure |
diag_cs |
Diagnostics control structure |
set_vertical |
If true or missing, set up vertical axes |
integer psp =121
x:point,y:sum,z:point
Global Functions¶
subroutine, public set_axes_info( G G, GV GV, US US, param_file param_file, diag_cs diag_cs, set_vertical set_vertical )
Sets up diagnostics axes.
Parameters:
g |
Ocean grid structure |
gv |
ocean vertical grid structure |
us |
A dimensional unit scaling type |
param_file |
Parameter file structure |
diag_cs |
Diagnostics control structure |
set_vertical |
If true or missing, set up vertical axes |
subroutine, public set_masks_for_axes(G G, diag_cs diag_cs)
set_masks_for_axes sets up the 2d and 3d masks for diagnostics using the current grid recorded after calling diag_update_remap_grids()
Parameters:
g |
The ocean grid type. |
diag_cs |
A pointer to a type with many variables used for diagnostics |
subroutine, public diag_register_area_ids( diag_cs diag_cs, id_area_t id_area_t, id_area_q id_area_q )
Attaches the id of cell areas to axes groups for use with cell_measures.
Parameters:
diag_cs |
Diagnostics control structure |
id_area_t |
Diag_mediator id for area of h-cells |
id_area_q |
Diag_mediator id for area of q-cells |
subroutine, public register_cell_measure(G G, diag diag, Time Time)
Sets a handle inside diagnostics mediator to associate 3d cell measures.
Parameters:
g |
Ocean grid structure |
diag |
Regulates diagnostic output |
time |
Model time |
subroutine, public diag_associate_volume_cell_measure( diag_cs diag_cs, id_h_volume id_h_volume )
Attaches the id of cell volumes to axes groups for use with cell_measures.
Parameters:
diag_cs |
Diagnostics control structure |
id_h_volume |
Diag_manager id for volume of h-cells |
integer function, public diag_get_volume_cell_measure_dm_id(diag_cs diag_cs)
Returns diag_manager id for cell measure of h-cells.
Parameters:
diag_cs |
Diagnostics control structure |
subroutine, public define_axes_group( diag_cs diag_cs, handles handles, axes axes, nz nz, vertical_coordinate_number vertical_coordinate_number, x_cell_method x_cell_method, y_cell_method y_cell_method, v_cell_method v_cell_method, is_h_point is_h_point, is_q_point is_q_point, is_u_point is_u_point, is_v_point is_v_point, is_layer is_layer, is_interface is_interface, is_native is_native, needs_remapping needs_remapping, needs_interpolating needs_interpolating, xyave_axes xyave_axes )
Defines a group of “axes” from list of handles.
Parameters:
diag_cs |
Diagnostics control structure |
handles |
A list of 1D axis handles |
axes |
The group of 1D axes |
nz |
Number of layers in this diagnostic grid |
vertical_coordinate_number |
Index number for vertical coordinate |
x_cell_method |
A x-direction cell method used to construct the “cell_methods” attribute in CF convention |
y_cell_method |
A y-direction cell method used to construct the “cell_methods” attribute in CF convention |
v_cell_method |
A vertical direction cell method used to construct the “cell_methods” attribute in CF convention |
is_h_point |
If true, indicates this axes group for h-point located fields |
is_q_point |
If true, indicates this axes group for q-point located fields |
is_u_point |
If true, indicates this axes group for u-point located fields |
is_v_point |
If true, indicates this axes group for v-point located fields |
is_layer |
If true, indicates that this axes group is for a layer vertically-located field. |
is_interface |
If true, indicates that this axes group is for an interface vertically-located field. |
is_native |
If true, indicates that this axes group is for a native model grid. False for any other grid. |
needs_remapping |
If true, indicates that this axes group is for a intensive layer-located field that must be remapped to these axes. Used for rank>2. |
needs_interpolating |
If true, indicates that this axes group is for a sampled interface-located field that must be interpolated to these axes. Used for rank>2. |
xyave_axes |
The corresponding axes group for horizontally area-average diagnostics |
subroutine, public set_diag_mediator_grid(G G, diag_cs diag_cs)
Set up the array extents for doing diagnostics.
Parameters:
g |
The ocean’s grid structure |
diag_cs |
Structure used to regulate diagnostic output |
subroutine, public post_data_1d_k( diag_field_id diag_field_id, field field, diag_cs diag_cs, is_static is_static )
Make a real 1-d array diagnostic available for averaging or output.
Parameters:
diag_field_id |
The id for an output variable returned by a previous call to register_diag_field. |
field |
1-d array being offered for output or averaging |
diag_cs |
Structure used to regulate diagnostic output |
is_static |
If true, this is a static field that is always offered. |
subroutine, public enable_averaging( time_int_in time_int_in, time_end_in time_end_in, diag_cs diag_cs )
This subroutine enables the accumulation of time averages over the specified time interval.
Parameters:
time_int_in |
The time interval [s] over which any values that are offered are valid. |
time_end_in |
The end time of the valid interval |
diag_cs |
Structure used to regulate diagnostic output |
subroutine, public disable_averaging(diag_cs diag_cs)
Call this subroutine to avoid averaging any offered fields.
Parameters:
diag_cs |
Structure used to regulate diagnostic output |
logical function, public query_averaging_enabled( diag_cs diag_cs, time_int time_int, time_end time_end )
Call this subroutine to determine whether the averaging is currently enabled. .true. is returned if it is.
Parameters:
diag_cs |
Structure used to regulate diagnostic output |
time_int |
Current setting of diagtime_int [s] |
time_end |
Current setting of diagtime_end |
type(time_type) function, public get_diag_time_end(diag_cs diag_cs)
This function returns the valid end time for use with diagnostics that are handled outside of the MOM6 diagnostics infrastructure.
Parameters:
diag_cs |
Structure used to regulate diagnostic output |
integer function, public register_diag_field( module_name module_name, field_name field_name, axes_in axes_in, init_time init_time, long_name long_name, units units, missing_value missing_value, range range, mask_variant mask_variant, standard_name standard_name, verbose verbose, do_not_log do_not_log, err_msg err_msg, interp_method interp_method, tile_count tile_count, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name, cell_methods cell_methods, x_cell_method x_cell_method, y_cell_method y_cell_method, v_cell_method v_cell_method, conversion conversion, v_extensive v_extensive )
Returns the “diag_mediator” handle for a group (native, CMOR, z-coord, …) of diagnostics derived from one field.
Parameters:
module_name |
Name of this module, usually “ocean_model” or “ice_shelf_model” |
field_name |
Name of the diagnostic field |
axes_in |
Container w/ up to 3 integer handles that indicates axes for this field |
init_time |
Time at which a field is first available? |
long_name |
Long name of a field. |
units |
Units of a field. |
standard_name |
Standardized name associated with a field |
missing_value |
A value that indicates missing values. |
range |
Valid range of a variable (not used in MOM?) |
mask_variant |
If true a logical mask must be provided with post_data calls (not used in MOM?) |
verbose |
If true, FMS is verbose (not used in MOM?) |
do_not_log |
If true, do not log something (not used in MOM?) |
err_msg |
String into which an error message might be placed (not used in MOM?) |
interp_method |
If ‘none’ indicates the field should not be interpolated as a scalar |
tile_count |
no clue (not used in MOM?) |
cmor_field_name |
CMOR name of a field |
cmor_long_name |
CMOR long name of a field |
cmor_units |
CMOR units of a field |
cmor_standard_name |
CMOR standardized name associated with a field |
cell_methods |
String to append as cell_methods attribute. Use ‘’ to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction. |
x_cell_method |
Specifies the cell method for the x-direction. Use ‘’ have no method. |
y_cell_method |
Specifies the cell method for the y-direction. Use ‘’ have no method. |
v_cell_method |
Specifies the cell method for the vertical direction. Use ‘’ have no method. |
conversion |
A value to multiply data by before writing to file |
v_extensive |
True for vertically extensive fields (vertically integrated). Default/absent for intensive. |
integer function, public register_scalar_field( module_name module_name, field_name field_name, init_time init_time, diag_cs diag_cs, long_name long_name, units units, missing_value missing_value, range range, standard_name standard_name, do_not_log do_not_log, err_msg err_msg, interp_method interp_method, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name )
Parameters:
module_name |
Name of this module, usually “ocean_model” or “ice_shelf_model” |
field_name |
Name of the diagnostic field |
init_time |
Time at which a field is first available? |
diag_cs |
Structure used to regulate diagnostic output |
long_name |
Long name of a field. |
units |
Units of a field. |
standard_name |
Standardized name associated with a field |
missing_value |
A value that indicates missing values. |
range |
Valid range of a variable (not used in MOM?) |
do_not_log |
If true, do not log something (not used in MOM?) |
err_msg |
String into which an error message might be placed (not used in MOM?) |
interp_method |
If ‘none’ indicates the field should not be interpolated as a scalar |
cmor_field_name |
CMOR name of a field |
cmor_long_name |
CMOR long name of a field |
cmor_units |
CMOR units of a field |
cmor_standard_name |
CMOR standardized name associated with a field |
Returns:
An integer handle for a diagnostic array.
integer function, public register_static_field( module_name module_name, field_name field_name, axes axes, long_name long_name, units units, missing_value missing_value, range range, mask_variant mask_variant, standard_name standard_name, do_not_log do_not_log, interp_method interp_method, tile_count tile_count, cmor_field_name cmor_field_name, cmor_long_name cmor_long_name, cmor_units cmor_units, cmor_standard_name cmor_standard_name, area area, x_cell_method x_cell_method, y_cell_method y_cell_method, area_cell_method area_cell_method, conversion conversion )
Registers a static diagnostic, returning an integer handle.
Parameters:
module_name |
Name of this module, usually “ocean_model” or “ice_shelf_model” |
field_name |
Name of the diagnostic field |
axes |
Container w/ up to 3 integer handles that indicates axes for this field |
long_name |
Long name of a field. |
units |
Units of a field. |
standard_name |
Standardized name associated with a field |
missing_value |
A value that indicates missing values. |
range |
Valid range of a variable (not used in MOM?) |
mask_variant |
If true a logical mask must be provided with post_data calls (not used in MOM?) |
do_not_log |
If true, do not log something (not used in MOM?) |
interp_method |
If ‘none’ indicates the field should not be interpolated as a scalar |
tile_count |
no clue (not used in MOM?) |
cmor_field_name |
CMOR name of a field |
cmor_long_name |
CMOR long name of a field |
cmor_units |
CMOR units of a field |
cmor_standard_name |
CMOR standardized name associated with a field |
area |
fms_id for area_t |
x_cell_method |
Specifies the cell method for the x-direction. |
y_cell_method |
Specifies the cell method for the y-direction. |
area_cell_method |
Specifies the cell method for area |
conversion |
A value to multiply data by before writing to file |
Returns:
An integer handle for a diagnostic array.
integer function, public ocean_register_diag( var_desc var_desc, G G, diag_CS diag_CS, day day )
Registers a diagnostic using the information encapsulated in the vardesc type argument and returns an integer handle to this diagostic. That integer handle is negative if the diagnostic is unused.
Parameters:
var_desc |
The vardesc type describing the diagnostic |
g |
The ocean’s grid type |
diag_cs |
The diagnotic control structure |
day |
The current model time |
Returns:
An integer handle to this diagnostic.
subroutine, public diag_mediator_infrastructure_init(err_msg err_msg)
Parameters:
err_msg |
An error message |
subroutine, public diag_mediator_init( G G, GV GV, US US, nz nz, param_file param_file, diag_cs diag_cs, doc_file_dir doc_file_dir )
diag_mediator_init initializes the MOM diag_mediator and opens the available diagnostics file, if appropriate.
Parameters:
g |
The ocean grid type. |
gv |
The ocean vertical grid structure |
us |
A dimensional unit scaling type |
nz |
The number of layers in the model’s native grid. |
param_file |
Parameter file structure |
diag_cs |
A pointer to a type with many variables used for diagnostics |
doc_file_dir |
A directory in which to create the file |
subroutine, public diag_set_state_ptrs( h h, T T, S S, eqn_of_state eqn_of_state, diag_cs diag_cs )
Set pointers to the default state fields used to remap diagnostics.
Parameters:
h |
the model thickness array |
t |
the model temperature array |
s |
the model salinity array |
eqn_of_state |
Equation of state structure |
diag_cs |
diag mediator control structure |
subroutine, public diag_update_remap_grids( diag_cs diag_cs, alt_h alt_h, alt_T alt_T, alt_S alt_S )
Build/update vertical grids for diagnostic remapping.
The target grids need to be updated whenever sea surface height changes.
Parameters:
diag_cs |
Diagnostics control structure |
alt_h |
Used if remapped grids should be something other than the current thicknesses |
alt_t |
Used if remapped grids should be something other than the current temperatures |
alt_s |
Used if remapped grids should be something other than the current salinity |
subroutine, public diag_masks_set(G G, nz nz, diag_cs diag_cs)
Sets up the 2d and 3d masks for native diagnostics.
Parameters:
g |
The ocean grid type. |
nz |
The number of layers in the model’s native grid. |
diag_cs |
A pointer to a type with many variables used for diagnostics |
subroutine, public diag_mediator_close_registration(diag_CS diag_CS)
Parameters:
diag_cs |
Structure used to regulate diagnostic output |
subroutine, public diag_mediator_end( time time, diag_CS diag_CS, end_diag_manager end_diag_manager )
Parameters:
time |
The current model time |
diag_cs |
Structure used to regulate diagnostic output |
end_diag_manager |
If true, call diag_manager_end() |
subroutine, public diag_grid_storage_init( grid_storage grid_storage, G G, diag diag )
Allocates fields necessary to store diagnostic remapping fields.
Parameters:
grid_storage |
Structure containing a snapshot of the target grids |
g |
Horizontal grid |
diag |
Diagnostic control structure used as the contructor template for this routine |
subroutine, public diag_copy_diag_to_storage( grid_storage grid_storage, h_state h_state, diag diag )
Copy from the main diagnostic arrays to the grid storage as well as the native thicknesses.
Parameters:
grid_storage |
Structure containing a snapshot of the target grids |
h_state |
Current model thicknesses |
diag |
Diagnostic control structure used as the contructor |
subroutine, public diag_copy_storage_to_diag( diag diag, grid_storage grid_storage )
Copy from the stored diagnostic arrays to the main diagnostic grids.
Parameters:
diag |
Diagnostic control structure used as the contructor |
grid_storage |
Structure containing a snapshot of the target grids |
subroutine, public diag_save_grids(diag diag)
Save the current diagnostic grids in the temporary structure within diag.
Parameters:
diag |
Diagnostic control structure used as the contructor |
subroutine, public diag_restore_grids(diag diag)
Restore the diagnostic grids from the temporary structure within diag.
Parameters:
diag |
Diagnostic control structure used as the contructor |
subroutine, public diag_grid_storage_end(grid_storage grid_storage)
Deallocates the fields in the remapping fields container.
Parameters:
grid_storage |
Structure containing a snapshot of the target grids |