Skip to content

Commit 4e67361

Browse files
committed
+Revise MOM_IceShelf available diags file format
Revised the MOM_ice_shelf_diag_mediator code that creates the MOM_IceShelf.available_diags file to follow the same pattern of logging as the rest of MOM6. The specific changes include moving the module name(s) to their own line, adding static diagnostics to the variables that are logged in the available_diags file (however, the ice shelf code does not have any static diagnostics yet), logging the axes of the diagnostic, and adding cell metrics to describe how a diagnostic might be reduced and logging these as well. All solutions are bitwise identical, but there are new entries and added information in the MOM_IceShelf.available_diags files.
1 parent 55d064c commit 4e67361

1 file changed

Lines changed: 16 additions & 30 deletions

File tree

src/ice_shelf/MOM_ice_shelf_diag_mediator.F90

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,8 @@ function register_MOM_IS_diag_field(module_name, field_name, axes_in, init_time,
715715
type(diag_ctrl), pointer :: diag_cs => NULL() ! A structure that is used to regulate diagnostic output
716716
type(axes_grp), pointer :: axes
717717
integer :: dm_id
718-
character(len=256) :: msg, cm_string
718+
character(len=256) :: msg
719+
character(len=256) :: cm_string ! A string describing the cell methods returned from attach_cell_methods.
719720
character(len=256) :: new_module_name
720721
character(len=480) :: module_list, var_list
721722
character(len=24) :: dimensions
@@ -775,9 +776,7 @@ function register_MOM_IS_diag_field(module_name, field_name, axes_in, init_time,
775776
if (is_root_pe() .and. (diag_CS%available_diag_doc_unit > 0)) then
776777
msg = ''
777778
if (present(cmor_field_name)) msg = 'CMOR equivalent is "'//trim(cmor_field_name)//'"'
778-
cm_string = ''
779-
!### Uncoment this to add cell methods:
780-
! call attach_cell_methods(-1, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
779+
call attach_cell_methods(-1, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
781780
module_list = trim(module_list)//"}"
782781
if (num_modnm <= 1) module_list = module_name
783782
if (num_varnm <= 1) var_list = ''
@@ -839,7 +838,8 @@ logical function register_diag_field_expand_cmor(dm_id, module_name, field_name,
839838
type(diag_ctrl), pointer :: diag_cs => null()
840839
type(diag_type), pointer :: this_diag => null()
841840
integer :: fms_id
842-
character(len=256) :: posted_cmor_units, posted_cmor_standard_name, posted_cmor_long_name, cm_string
841+
character(len=256) :: posted_cmor_units, posted_cmor_standard_name, posted_cmor_long_name
842+
character(len=256) :: cm_string ! A string describing the cell methods returned from attach_cell_methods.
843843

844844
MOM_missing_value = axes%diag_cs%missing_value
845845
if (present(missing_value)) MOM_missing_value = missing_value
@@ -854,9 +854,7 @@ logical function register_diag_field_expand_cmor(dm_id, module_name, field_name,
854854
verbose=verbose, do_not_log=do_not_log, err_msg=err_msg, &
855855
interp_method=interp_method, tile_count=tile_count)
856856
if (.not. diag_cs%diag_as_chksum) &
857-
cm_string = ''
858-
!### Uncoment this to add cell methods:
859-
! call attach_cell_methods(fms_id, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
857+
call attach_cell_methods(fms_id, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
860858

861859
this_diag => null()
862860
if (fms_id /= DIAG_FIELD_NOT_FOUND) then
@@ -888,9 +886,7 @@ logical function register_diag_field_expand_cmor(dm_id, module_name, field_name,
888886
missing_value=MOM_missing_value, range=range, mask_variant=mask_variant, &
889887
standard_name=trim(posted_cmor_standard_name), verbose=verbose, do_not_log=do_not_log, &
890888
err_msg=err_msg, interp_method=interp_method, tile_count=tile_count)
891-
cm_string = ''
892-
!### Uncoment this to add cell methods:
893-
! call attach_cell_methods(fms_id, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
889+
call attach_cell_methods(fms_id, axes, cm_string, cell_methods, x_cell_method, y_cell_method)
894890

895891
this_diag => null()
896892
if (fms_id /= DIAG_FIELD_NOT_FOUND) then
@@ -1378,8 +1374,7 @@ function register_MOM_IS_static_field(module_name, field_name, axes, &
13781374
if (len_trim(dimensions) > 0) dimensions = trim_trailing_commas(dimensions)
13791375

13801376
! Document diagnostics in list of available diagnostics
1381-
!### if (is_root_pe() .and. diag_CS%available_diag_doc_unit > 0) then
1382-
if (is_root_pe() .and. .false.) then ! Replace this to work like MOM6.
1377+
if (is_root_pe() .and. diag_CS%available_diag_doc_unit > 0) then
13831378
if (present(cmor_field_name)) then
13841379
call log_available_diag(associated(diag), module_name, field_name, '', '', diag_CS, &
13851380
long_name, units, standard_name, &
@@ -1728,34 +1723,25 @@ subroutine log_available_diag(used, module_name, field_name, cell_methods_string
17281723
character(len=240) :: mesg
17291724

17301725
if (used) then
1731-
mesg = '"'//trim(module_name)//'", "'//trim(field_name)//'" [Used]'
1726+
mesg = '"'//trim(field_name)//'" [Used]'
17321727
else
1733-
mesg = '"'//trim(module_name)//'", "'//trim(field_name)//'" [Unused]'
1728+
mesg = '"'//trim(field_name)//'" [Unused]'
17341729
endif
1735-
!### This form of output agrees with MOM_diag_manager:
1736-
! if (used) then
1737-
! mesg = '"'//trim(field_name)//'" [Used]'
1738-
! else
1739-
! mesg = '"'//trim(field_name)//'" [Unused]'
1740-
! endif
17411730
if (len(trim((comment)))>0) then
17421731
write(diag_CS%available_diag_doc_unit, '(a,1x,"(",a,")")') trim(mesg),trim(comment)
17431732
else
17441733
write(diag_CS%available_diag_doc_unit, '(a)') trim(mesg)
17451734
endif
1746-
!### These should be uncommented later to align with MOM_diag_manager:
1747-
! call describe_option("modules", module_name, diag_CS)
1748-
! if (present(dimensions)) then
1749-
! if (len(trim(dimensions)) > 0) then
1750-
! call describe_option("dimensions", dimensions, diag_CS)
1751-
! endif
1752-
! endif
1735+
call describe_option("modules", module_name, diag_CS)
1736+
if (present(dimensions)) then ; if (len(trim(dimensions)) > 0) then
1737+
call describe_option("dimensions", dimensions, diag_CS)
1738+
endif ; endif
17531739
if (present(long_name)) call describe_option("long_name", long_name, diag_CS)
17541740
if (present(units)) call describe_option("units", units, diag_CS)
17551741
if (present(standard_name)) &
17561742
call describe_option("standard_name", standard_name, diag_CS)
1757-
! if (len(trim((cell_methods_string)))>0) &
1758-
! call describe_option("cell_methods", trim(cell_methods_string), diag_CS)
1743+
if (len(trim((cell_methods_string)))>0) &
1744+
call describe_option("cell_methods", trim(cell_methods_string), diag_CS)
17591745
if (present(variants)) then ; if (len(trim(variants)) > 0) then
17601746
call describe_option("variants", variants, diag_CS)
17611747
endif ; endif

0 commit comments

Comments
 (0)