Skip to content

Dm update: diag_yaml_object_init() tests#883

Merged
thomas-robinson merged 13 commits into
NOAA-GFDL:dmUpdatefrom
uramirez8707:dmUpdate_test
Jan 12, 2022
Merged

Dm update: diag_yaml_object_init() tests#883
thomas-robinson merged 13 commits into
NOAA-GFDL:dmUpdatefrom
uramirez8707:dmUpdate_test

Conversation

@uramirez8707
Copy link
Copy Markdown
Contributor

Description
This PR:

  • Adds checks to see if the diag_yaml had valid values
  • Adds a test for diag_yaml_init()
  • Adds a tests to determine if the code is crashing as expected

These new tests only run if using --with-yaml
Note: This PR includes updates from main

TO DO:

  • Move diag_yaml_object.F90 to diag_yaml.F90
  • Need to make the variables in the types private
  • The get_* functions in diag_yaml_object.F90 need to follow the style guide (result() needs to be its own line)

Fixes # (issue)

How Has This Been Tested?
make check passes with intel21 and gnu on Skylake

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

Comment on lines +70 to +75
function get_diag_yaml_obj() &
result(res)
type (diagYamlObject_type) :: res

res = diag_yaml
end function get_diag_yaml_obj
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.

This was added for the test.
The test will get a copy for the private diag_yaml module variable, and then use the get_* functions to check for the correct values.

Comment thread diag_manager/fms_diag_yaml.F90 Outdated
Comment thread diag_manager/fms_diag_yaml.F90 Outdated
Comment thread diag_manager/fms_diag_yaml.F90 Outdated
Comment thread diag_manager/fms_diag_yaml.F90 Outdated
Comment thread test_fms/diag_manager/diagTables/diag_table_26
Comment thread test_fms/parser/test_yaml_parser.F90 Outdated
!! Try get_value_from_key using a r8 buffer
call get_value_from_key(yaml_file_id1, variable_ids(1), "fill_value", r8_buffer)
if (r8_buffer .ne. real(-999.9, kind=r8_kind)) call mpp_error(FATAL, "fill_value was not read correctly as an r8!")
if (abs(r8_buffer - real(-999.9, kind=r8_kind)) .gt. 5e-5) call mpp_error(FATAL, "fill_value was not read correctly as an r8!")
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.

Since this is using real*8s, I think you want to change the e to a d

abs(r8_buffer - real(-999.9, kind=r8_kind)) .gt. 5d-5

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.

@rem1776 This will need to be done in main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@rem1776 #886 is approved.
@uramirez8707 are you going to merge it in and then we can merge this PR?

@thomas-robinson thomas-robinson merged commit 2c218d0 into NOAA-GFDL:dmUpdate Jan 12, 2022
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