-
Notifications
You must be signed in to change notification settings - Fork 209
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
Check flds for nan #1765
Merged
Merged
Check flds for nan #1765
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b0410ef
add a check for nan for all fields passed to coupler
jedwards4b 24533ee
do not check unused components
jedwards4b 171ce84
remove unused var, remove tests from scripts_regression_tests.py
jedwards4b a92b522
remove test code
jedwards4b 855d3ea
move check_fields to component_type_mod
jedwards4b 9cb309e
add unit test (not working)
jedwards4b 5105bbf
unit tests ready
jedwards4b db22c94
remove check_fields unit test until issue 140 is addressed
jedwards4b e676e3d
add namelist control variable
jedwards4b c3a12e9
fix namelist issue and refactor for performance
jedwards4b ff252f6
rebase to master, enable unit tests
jedwards4b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,11 +276,11 @@ MODULE seq_infodata_mod | |
!=============================================================================== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about white space diffs. |
||
!BOP =========================================================================== | ||
! | ||
! !IROUTINE: seq_infodata_Init -- read in CCSM shared namelist | ||
! !IROUTINE: seq_infodata_Init -- read in CIME shared namelist | ||
! | ||
! !DESCRIPTION: | ||
! | ||
! Read in input from seq_infodata_inparm namelist, output ccsm derived type for | ||
! Read in input from seq_infodata_inparm namelist, output cime derived type for | ||
! miscillaneous info. | ||
! | ||
! !INTERFACE: ------------------------------------------------------------------ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
create_pFUnit_test(check_fields check_fields_exe | ||
"test_check_fields.pf" "") | ||
|
||
target_link_libraries(check_fields_exe ${DRV_UNIT_TEST_LIBS}) |
99 changes: 99 additions & 0 deletions
99
src/drivers/mct/unit_test/check_fields_test/test_check_fields.pf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
module test_check_fields | ||
|
||
! Tests of check_fields in the component_type_mod, check_fields looks for NaN values | ||
! in fields passed from components to the coupler | ||
|
||
use pfunit_mod | ||
use component_type_mod | ||
use mct_mod | ||
use mct_wrapper_mod, only : mct_init, mct_clean | ||
use avect_wrapper_mod | ||
use create_mapper_mod | ||
use shr_kind_mod, only : r8 => shr_kind_r8 | ||
use shr_infnan_mod, only : shr_infnan_nan, assignment(=) | ||
implicit none | ||
|
||
@TestCase | ||
type, extends(TestCase) :: TestCheckFields | ||
type(component_type) :: comp | ||
contains | ||
procedure :: setUp | ||
procedure :: tearDown | ||
end type TestCheckFields | ||
|
||
contains | ||
|
||
subroutine setUp(this) | ||
class(TestCheckFields), intent(inout) :: this | ||
|
||
call mct_init() | ||
end subroutine setUp | ||
|
||
subroutine tearDown(this) | ||
class(TestCheckFields), intent(inout) :: this | ||
call mct_aVect_clean(this%comp%c2x_cc) | ||
call mct_clean() | ||
end subroutine tearDown | ||
|
||
@Test | ||
subroutine createAVectWithoutData_1Field_checkField(this) | ||
class(TestCheckFields), intent(inout) :: this | ||
character(len=*), parameter :: attr_tag = 'foo' | ||
integer, parameter :: lsize = 5 ! | ||
character(len=64) :: actual_rlist | ||
real(r8) :: nan | ||
|
||
nan = shr_infnan_nan | ||
if(.not. associated(this%comp%c2x_cc)) allocate(this%comp%c2x_cc) | ||
call create_aVect_without_data(this%comp%c2x_cc, [attr_tag], lsize) | ||
|
||
actual_rlist = mct_aVect_exportRList2c(this%comp%c2x_cc) | ||
@assertEqual('foo', trim(actual_rlist)) | ||
|
||
this%comp%c2x_cc%rattr(1,3) = nan | ||
|
||
this%comp%name = 'pfunittest' | ||
|
||
if(.not. associated(this%comp%gsmap_cc)) allocate(this%comp%gsmap_cc) | ||
|
||
call create_gsmap(this%comp%gsmap_cc, lsize) | ||
|
||
call check_fields(this%comp, 1) | ||
@assertExceptionRaised('ABORTED: component_mod:check_fields NaN found in pfunittest instance: 1 field foo 1d global index: 3') | ||
|
||
end subroutine createAVectWithoutData_1Field_checkField | ||
|
||
@Test | ||
subroutine createAVectWithoutData_3Field_checkFields(this) | ||
class(TestCheckFields), intent(inout) :: this | ||
character(len=*), parameter :: attr_tag1 = 'foo1' | ||
character(len=*), parameter :: attr_tag2 = 'foo2' | ||
character(len=*), parameter :: attr_tag3 = 'bar ' | ||
character(len=*), parameter :: expected_rlist = 'foo1:foo2:bar' | ||
integer, parameter :: lsize = 5 ! not important for this test | ||
character(len=64) :: actual_rlist | ||
real(r8) :: nan | ||
|
||
nan = shr_infnan_nan | ||
|
||
this%comp%name = 'pfunittest' | ||
|
||
if(.not. associated(this%comp%c2x_cc)) allocate(this%comp%c2x_cc) | ||
|
||
call create_aVect_without_data(this%comp%c2x_cc, [attr_tag1, attr_tag2, attr_tag3], lsize) | ||
|
||
actual_rlist = mct_aVect_exportRList2c(this%comp%c2x_cc) | ||
@assertEqual(expected_rlist, actual_rlist) | ||
|
||
if(.not. associated(this%comp%gsmap_cc)) allocate(this%comp%gsmap_cc) | ||
|
||
this%comp%c2x_cc%rattr(2,3) = nan | ||
|
||
call create_gsmap(this%comp%gsmap_cc, lsize) | ||
|
||
call check_fields(this%comp, 1) | ||
|
||
@assertExceptionRaised('ABORTED: component_mod:check_fields NaN found in pfunittest instance: 1 field foo2 1d global index: 3') | ||
end subroutine createAVectWithoutData_3Field_checkFields | ||
|
||
end module test_check_fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There still seems to be a lot of white space diffs. Can we remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed all whitespace in #1766 accepting that will remove the differences in this one.