Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modern_diag_manager: Update output_buffer_obj #1354

Merged
merged 6 commits into from
Sep 8, 2023

Conversation

uramirez8707
Copy link
Contributor

@uramirez8707 uramirez8707 commented Aug 24, 2023

Description

  1. Update initialize_buffer so that it initializes the buffer based on the reduction method: MIN_VALUE for time_min, MAX_VALUE for time_max and EMPTY for others (instead of the missing_value). This is needed for the reduction methods to work correctly (i.e when averaging you are simply adding the input data to the output buffer so if it is the output buffer is initialized to the missing value it won't be correct. The tests were updated to account for this change.
  2. Update the do_time_none_wrapper and do_time_none functions so that they take in the missing value. Data points that are masked will be set to this.
  3. Add the variable done_writing_data to the diag_file object. This will be used for static files after the first write and for files that are using the file_duration functionality.
  4. Added done_with_math to the buffer object and setters and getters functions. This will be used for static variables that are in time_varying files.
  5. Reinitializes the buffer after writing the data
    Fixes # (issue)

How Has This Been Tested?
CI

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

…r routine to match the old diag manager, adjust tests, add a flag that indicates when done writing data to the diag_file, set output buffers to fill value if masked
@uramirez8707 uramirez8707 marked this pull request as ready for review August 25, 2023 21:58
@@ -67,6 +67,7 @@ module fms_diag_file_object_mod
TYPE(time_type) :: next_output !< Time of the next write
TYPE(time_type) :: next_next_output !< Time of the next next write
TYPE(time_type) :: no_more_data !< Time to stop receiving data for this file
logical :: done_writing_data!< .True. if finished writing data
Copy link
Member

Choose a reason for hiding this comment

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

finished writing data for the time step? It's a little unclear to me what point of the process this gets turned to true. Maybe data_written_for_timestep would be more descriptive if that's the intent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for the diag file object.
I think there are two cases where this will be set to true:

  1. Static files after the first write
  2. Files that are using the file_duration functionality in the yaml file

Copy link
Member

Choose a reason for hiding this comment

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

Can you add that to the documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

diag_manager/fms_diag_object.F90 Show resolved Hide resolved
diag_manager/fms_diag_object.F90 Show resolved Hide resolved

!TODO mostly everything
field_ptr => this%FMS_diag_fields(diag_field_id)
if (field_ptr%has_missing_value()) then
select type (missing_val => field_ptr%get_missing_value(r8))
type is (real(kind=r8_kind))
Copy link
Member

Choose a reason for hiding this comment

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

Where is the r4_kind?

end function is_done_with_math

!> @brief Set done_with_math to .true.
subroutine set_done_with_math(this)
Copy link
Member

Choose a reason for hiding this comment

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

How do you set it to false? I think this should take a logical argument so you can set it to true or false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think you will you ever set it back to .false.
This will be set to .true. for variables that are static after the "math" (a copy) is done for the first time.

@thomas-robinson thomas-robinson merged commit 3e4faad into NOAA-GFDL:dmUpdate Sep 8, 2023
18 checks passed
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
* Add some needed members to the buffer obj, restructure the init_buffer routine to match the old diag manager, adjust tests, add a flag that indicates when done writing data to the diag_file, set output buffers to fill value if masked

* inits done_with_math
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
* Add some needed members to the buffer obj, restructure the init_buffer routine to match the old diag manager, adjust tests, add a flag that indicates when done writing data to the diag_file, set output buffers to fill value if masked

* inits done_with_math
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
rem1776 pushed a commit to rem1776/FMS that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants