Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions diag_manager/fms_diag_file_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ module fms_diag_file_object_mod

contains
procedure, public :: add_field_and_yaml_id
procedure, public :: is_field_registered
procedure, public :: init_diurnal_axis
procedure, public :: has_file_metadata_from_model
procedure, public :: has_fileobj
Expand Down Expand Up @@ -255,6 +256,15 @@ logical function fms_diag_files_object_init (files_array)
endif
end function fms_diag_files_object_init

!< @brief Determine if the field corresponding to the field_id was registered to the file
!! @return .True. if the field was registed to the file
logical function is_field_registered(this, field_id)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this pure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class(fmsDiagFile_type), intent(inout) :: this !< The file object
integer, intent(in) :: field_id !< Id of the field to check

is_field_registered = this%field_registered(field_id)
end function is_field_registered

!> \brief Adds a field and yaml ID to the file
subroutine add_field_and_yaml_id (this, new_field_id, yaml_id)
class(fmsDiagFile_type), intent(inout) :: this !< The file object
Expand Down
3 changes: 3 additions & 0 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ subroutine fms_diag_send_complete(this, time_step)
allocate (file_field_ids(size(diag_file%FMS_diag_file%get_field_ids() )))
file_field_ids = diag_file%FMS_diag_file%get_field_ids()
field_loop: do ifield = 1, size(file_field_ids)
! If the field is not registered go away
if (.not. diag_file%FMS_diag_file%is_field_registered(ifield)) cycle

diag_field => this%FMS_diag_fields(file_field_ids(ifield))
!> Check if math needs to be done
! math = diag_field%get_math_needs_to_be_done()
Expand Down